Processor adapted for sharing memory with more than one type of processor

ABSTRACT

A processor specially adapted for use as a coprocessor. The processor is implemented as a microprocessor. The adaptations include the following: The microprocessor has a master-slave pin which receives an input which determines whether the microprocessor operates as a bus master or a bus slave. Certain output pins have three-state bus drivers which employ feedback to ensure that a signal on a line being even by the driver has gone inactive before the driver is turned off. Instructions executed by the microprocessor permit specification of portions of the internal registers as sources and destinations and specification of the size of an ALU operation, permitting easy operation on data ranging from bytes through 24-bit pointers. Instructions are executed in an instruction pipeline and a separate I/O instruction pipeline. Some pipeline stalls are avoided by means of a special MOVE instruction which differs from an ordinary MOVE instruction in that it does not cause pipeline stall when it reads data from a register loaded by a preceding READ instruction. The microprocessor also has an Intel/Motorola pin whose input specifies the type of host processor the coprocessor is working with and further executes I/O instructions which permit the same code to be used with either host processor.

CROSS-REFERENCE TO RELATED APPLICATIONS

The following patent applications have substantially the same DetailedDescription and Drawings as the present application and were filed onthe same date as the present application:

U.S. Ser. No. 7/490,172, U.S. Pat. No. 5,278,959, Gary T. Corcoran,Robert C. Fairfield, Processor Usable as a Bus Master or a Bus Slave

U.S. Ser. No. 07/493,012, U.S. Pat. No. 5,321,342, Robert C. Fairfield,Robert R. Spiwak, Akkas T. Sufi, Three-state Driver withFeedback-controlled Switching

U.S. Ser. No. 08/044,556, pending Gary T. Corcoran, Robert C. Fairfield,Processor having General Registers with Separately-SpecifiableSubdivisions

U.S. Ser. No. 08/063,354, U.S. Pat. No. 5,327,537, Gary T. Corcoran,Robert C. Fairfield, Apparatus for Controlling Instruction Execution ina Pipelined Processor

TECHNICAL FIELD

The invention relates to digital data processors generally and morespecifically to processors employed as coprocessors.

BACKGROUND OF THE INVENTION

1. Field of the Invention

As processors have gotten cheaper, more and more digital data processingsystems have appeared in which several processors operate ascoprocessors. A coprocessor is a processor which cooperates with anotherprocessor to process dam. Classic examples of coprocessors arefloating-point units for performing floating point arithmetic and I/Oprocessors for handling the flow of data between peripheral devices suchas terminals and the system memory. The relationship between twocoprocessors lies along a continuum whose ends are described by thenotions tightly coupled and loosely coupled. One coprocessor is tightlycoupled to another when there is a high degree of direct interactionbetween the coprocessors. For example, floating point units aretypically tightly coupled. The processor served by the floating pointunit provides the operands to the floating point unit, indicates theoperation to be performed, and receives the results directly from thefloating point unit. The results typically not only include the resultvalue, but also signals indicating the status of the floating pointoperation. I/O processors, on the other hand, are typically looselycoupled. Communication with the processor they serve is generallythrough the system memory. When the processor requires the assistance ofthe I/O processor to output data, the processor places the output dataand a description of what the I/O processor is to do with it in memoryat a location known to the I/O processor and then indicates to the I/Oprocessor that the data is in memory. The I/O processor thereuponresponds to the indication by retrieving the data from memory andoutputting it to the desired peripheral device. When it is finished, itputs a record of the status of the operation in memory at a locationknown to the processor and indicates to the processor that it hasfinished the memory operation. The processor then responds to theindication by reading the data at the location to determine the statusof the output operation.

2. Description of the Prior Art

A problem with memory sharing is that the processors which share thememory must agree on the format of the data which they jointly process.For example, two popular architectures for host processors are theMotorola 680×0 architecture and the Intel 80×86 architecture. These twoarchitectures have different formats for pointers and for the order inwhich consecutively written bytes are stored in memory. A coprocessorwhich is to be used with either kind of host must some how deal withthese differences. One way of dealing with them in the prior art hasbeen a pin on the coprocessor whose input indicates whether the host isa 680×0 machine or an Intel 80×86 machine. This solution works well aslong as the coprocessor reads data in exactly the same way as the hostwrote it and vice-versa. The problem with such a solution is that itgives the system designer the choice of slowing the coprocessor down orwriting code for the coprocessor which is different for the differentkinds of hosts. If the coprocessor reads words as well as bytes and thehost has written a sequence of bytes in memory, then the fastest way forthe coprocessor to read the bytes is as words; however, if it does so,it will have to process the words differently depending on the hostmachine, and consequently different code will be necessary for thedifferent host machines. Speed and the cost of writing code are bothimportant considerations for the system designer, and consequently bothalternatives are unattractive. It is an object of the apparatusdisclosed herein to provide a processor which can both read sequences ofbytes as words and employ the same code for both host machines.

SUMMARY OF THE INVENTION

The invention disclosed herein is a processor which can share memorywith other processors employing different formats for data stored in thememory. The processor executes instructions including at least oneinstruction which has data format dependency indicating means. The dataformat dependency indicating means indicate that the operation isdependent on a data format employed by the other processor with whichthe processor of the invention is sharing memory. The processor of theinvention is characterized by data format signal receiving means forreceiving a data format signal indicating the data format and operationmeans responsive to the data format signal and the data formatdependency indicating means for performing the operation specified bythe instruction as required by the data format.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a system in which the microprocessor of thepresent invention is employed;

FIG. 2A and 2B is a diagram showing the pinouts of a preferredembodiment of the microprocessor;

FIG. 3 is a block diagram of a system in which one microprocessor isemployed as a bus master and the other as a bus slave;

FIG. 4 is a state diagram showing states of the microprocessor which areaffected by the master/slave pin;

FIG. 5 is a timing diagram showing bus req/ack timing in amicroprocessor in master mode with no I/O in progress;

FIG. 6 is a timing diagram showing bus req/ack timing in amicroprocessor in master mode with I/O in progress and pending;

FIG. 7 is a timing diagram showing bus req/ack timing in amicroprocessor in slave mode;

FIG. 8 is a logic diagram of the implementation of the BUSREQ and BUSACKpins in a preferred embodiment;

FIG. 9 is a byte or word read timing diagram showing how the AS and EREand ORE lines go high before they are turned off;

FIG. 10 is a logic diagram of the implementation of forcing certainlines high before they are turned off;

FIG. 11A is a block diagram showing the instruction architecture of apreferred embodiment of the microprocessor;

FIG. 11B is a block diagram showing addressing of general registers inthe microprocessor;

FIG. 12A is a diagram showing the format and manner of execution of twotypes of MOVE instructions for the microprocessor;

FIG. 12B is a diagram showing the format and manner of execution of athird type of MOVE instruction;

FIG. 13 is a diagram showing the format of system memory I/Oinstructions for the microprocessor;

FIG. 14 is a diagram showing pipelining with and without ILNW;

FIG. 15 is a diagram showing the format of an ALU instruction for themicroprocessor,

FIG. 16 is a logic diagram showing the implementation in a preferredembodiment of register size and ALU size;

FIG. 17 is a diagram of data formats employed by certain host processorswith which the microprocessor is employed;

FIG. 18 is a logic diagram showing control logic in the I/O subsystem ofa preferred embodiment;

FIG. 19 is a diagram showing operation of the instruction and I/Opipelines in a preferred embodiment;

FIG. 20 is a logic diagram showing an implementation of input latch 1149in a preferred embodiment;

FIG. 21 is a logic diagram showing an implementation of output latch1151 and shadow output latch 1155 in a preferred embodiment;

FIG. 22A and 22B are the is a truth table for READ and READ-MODIFY-WRITEI/O operations in a preferred embodiment; and

FIG. 23A and 23B are the truth table for WRITE I/O operations in apreferred embodiment.

Reference numbers used in the following "Detailed Description" have twoparts. The rightmost two digits refer to the number of the item beingreferenced in the first drawing in which it appears; the remainingdigits refer to the number of that drawing. Thus, an item with referencenumber "501" will first appear as item "501" in FIG. 5.

The portion of the Detailed Description beginning with the sectiontitled "I/O Subsection 1135" and FIGS. 11, 13, 17, 18, and 20-23 areparticularly relevant to the inventions claimed in the presentapplication.

DETAILED DESCRIPTION

The following Detailed Description of a preferred embodiment of themicroprocessor of the present invention will first show how themicroprocessor might be used as a coprocessor in a digital dataprocessing system, will then disclose the interface between themicroprocessor and such a system, and will continue with discussions ofcertain aspects of the microprocessor which are of special interest. Theaspects are the following:

Using the microprocessor as a bus master or a bus slave;

Forced inactive states on three state outputs before the outputs areturned off;

An instruction which affects the behavior of the microprocessor'sinstruction pipeline;

Specification of data size in move and ALU instructions; and

Coprocessor-dependent execution of system word read operations andsystem word write operations.

The aspects will be discussed in the above order.

System Employing the Microprocessor as a Coprocessor: FIG. 1

FIG. 1 shows a system 101 in which the microprocessor of the presentinvention is employed as a coprocessor. Components of the system includememory 102, system bus 103, host processor 105, microprocessor 107 ofthe present invention with its private memory (PMEM) 108, and serialcontroller (SCTL) 109. All of the components are connected by system bus103, and host processor 105, microprocessor 107, and serial controller109 all have access to memory 102 via system bus 103. Private memory 108is connected to microprocessor 107 by private bus (PB) 110. Privatememory 108 is accessible only to microprocessor 107. Contents of privatememory 108 include programs executed by microprocessor 107 and may alsoinclude data used in the execution of those programs. In a preferredembodiment, private memory 108 is a read-write memory and the programsexecuted by microprocessor 107 are downloaded by microprocessor 107 frommemory 102 into private memory 108.

In the system of FIG. 1, microprocessor 107 operates as a coprocessorfor dealing with data which is sent or received according to a serialcommunications protocol. As such, it mediates between host processor105, which is the source of, or destination for, the data which is sentor received via the protocol, and serial controller 109, which isconnected to serial link 111 and which transmits and receives serialprotocols over link 111.

Operation of system 101 is as follows: host processor 105 maintains thearea SDATA 115 in memory 102 which it uses for data to be sent over SL111 and RDATA 117 for data which is received over SL 111. When hostprocessor 105 wishes to send data, it places a command to that effect inhost command queue (HCQ) 119. The command includes at least adestination address for the data and the location of the data in SDATA115. Host command queue 119 is at a location in memory 102 which isknown to microprocessor 107, and microprocessor 107 periodically pollshost command queue 119 to determine whether a new command has arrived.When one has, microprocessor 107 locates the data to be sent in SDATA115, puts it into the proper form for serial controller 109, and placesa pointer to the data and a command into microprocessor command queue(MPCQ) 123. That queue is in a location in memory which is known toserial controller 109, and serial controller 109 periodically pollsmicroprocessor command queue 123. When serial controller 109 finds acommand and a pointer in queue 123, it outputs the data at the locationspecified by the pointer to serial link 111 in the manner specified bythe command.

When serial controller 109 receives data on serial link 111, the reverseof the above takes place. Serial controller 109 places the data it hasreceived in RDATA 117 and then places a pointer to the data inmicroprocessor interrupt queue (MPIQ) 125; microprocessor 107periodically polls queue 125, and when there is a pointer in queue 125,microprocessor 107 puts the data indicated by the pointer into theproper format for host processor 105. Thereupon, microprocessor 107places an interrupt message including a pointer to the data in hostinterrupt queue (HIQ) 121 and provides an interrupt to host processor105 via interrupt line 113. Host processor 105 responds to the interruptby examining host interrupt queue 121, and determines from the interruptmessage that incoming data has been placed in RDATA 117.

Interface between System 101 and Microprocessor 107: FIG. 2

FIG. 2 is a diagram showing the pins of a preferred embodiment 201 ofmicroprocessor 107 which is implemented as a single integrated circuitin a 132-pin package. Other embodiments may multiplex some pins, and inother embodiments, microprocessor 107 might be a component of a largerintegrated circuit; for example, microprocessor 107 and one or moreserial controllers 109 might be combined to form a single integratedcircuit for handling serial protocols. While microprocessor 107 wouldhave no pins of its own in such an embodiment, it would still send andreceive signals substantially equivalent to those sent and received viathe pins of preferred embodiment 201.

Certain of the pins of preferred embodiment 201 are of particularinterest in the following discussion. They are MASTER/SLAVE pin 207,BUSACK pin 203, BUSREQ pin 205, I/M pin 209, DTACK pin 211, and CLOCKpin 213. The functions of these pins, as well as all of the others, aresummarized in the following table:

    ______________________________________                                        132 Pin Package Pin Descriptions                                              (Fully non-multiplexed interface)                                             Symbol      Type    Name/Description                                          ______________________________________                                        A23-A1      O*      Twenty-four bit address bus used to                                           address memory 102. Address line                                              A0 is not explicit because it is not                                          needed in a 16 bit memory; it                                                 would only select which byte in a                                             16 bit word was to be accessed.                                               This information is supplied by the                                           two read enable and two write en-                                             able strobes when accessing                                                   memory.                                                   D15-D0      I/O*    Sixteen bit data bus used to read                                             and write memory 102.                                     PA15-PA0    O       Sixteen bit private address bus used                                          to address private memory 108.                            PD23-PD0    I/O     Twenty-four bit private data bus                                              used to read and write private                                                memory 108 which usually holds                                                instructions but may also be used                                             to store data when private memory                                             108 is RAM.                                                ##STR1##    O*      Address strobe. Active when                                                  microprocessor 107 has placed a                                               valid address on system bus 103.                           ##STR2##    O*      Read or Write data bus direction                                             indicator.                                                 ##STR3##    O*      Even Read Enable data strobe.                             ##STR4##    O*      Odd Read Enable data strobe.                              ##STR5##    O*      Even Write Enable data strobe.                            ##STR6##    O*      Odd Write Enable data strobe.                             ##STR7##    I       Data Transfer (Read/Write)                                                   acknowledge signal.                                        ##STR8##    I       System Bus Error input signal.                            ##STR9##    I       Interrupt input to microprocessor                                            107.                                                       ##STR10##   O       Interrupt output to another                                                  processor.                                                 ##STR11##   O       Private bus write strobe, active                                             when writing to private                                                       memory 108.                                                ##STR12##   I       Master reset, three-states all pins                                          when active.                                               ##STR13##   I       Three-states all pins when driven                                            low.                                                      CLOCK       I       Master clock input.                                        ##STR14##   I       Selects whether microprocessor 107                                           is a bus master or a bus slave                                                (requester). Microprocessor 107 is                                            a master if this pin is tied to VDD,                                          or a slave if the pin is grounded.                         ##STR15##   I       System memory format selector.                                               This pin should be grounded to                                                select "Motorola" memory formats,                                             or tied to VDD to select "Intel"                                              memory formats.                                            ##STR16##   I:O     Bus Request. When microprocessor                                             107 is a bus master, it is an input                                           from another device requesting use                                            of the system bus. When micro-                                                processor 107 is a bus slave, it                                              is used as an output to request use                                           of the system bus.                                         ##STR17##   O:I     Bus Acknowledge. When micro-                                                 processor 107 is a bus master, it is                                          an output, active when micro-                                                 processor 107 has relinquished use                                            of the system bus. When PACER is                                              a bus slave, it is an input, active                                           when use of the system                                                        bus has been granted.                                     VDD         Power   +5 volt power supply connections.                         GND         Power   Ground (power supply return)                                                  connections.                                              ______________________________________                                    

As may be seen from the above table, the preferred embodiment isintended for use in a system 101 in which memory 102 has 16-bit wordsand is byte addressable; system bus 103 consequently includes 23 addresslines, 16 data lines, and control lines. In some embodiments, thecontrol signals BUSACK, BUSREQ, BUSERR, CLOCK, DTACK, RESET, INTIN,INTOUT, EWE, OWE, ERE, ORE, and AS may be part of system bus 103; inothers, they may be provided to or received from other logic external tomicroprocessor 107 which mediates between system 101 and microprocessor107.

Implementation of the IC of the Preferred Embodiment

The integrated circuit of the preferred embodiment was implemented usingCMOS standard cell technology. Much of the control logic formicroprocessor 107 was specified as follows: first, a state machine wasdefined for a given portion of the control logic. The state machineconsisted of the states of the portion of the system being controlled bythe given portion of the control logic and the transitions between thestates. Next, an emulator for the state machine was written in the "C"language. The emulator was tested to confirm the correctness of thestate machine. Thereupon, the emulator code was used as an input to aso-called "silicon compiler". The output of the silicon compiler was aspecification of circuits in the integrated circuit of the preferredembodiment which implemented the state machine described by the emulatorcode.

The tools used to implement microprocessor 107 were well within thecurrent state of the art. As can be seen from this fact and theforegoing disclosure of the manner in which control logic inmicroprocessor 107 was implemented, a description of a state machine isall that is required by one skilled in the art to make and use circuitrywhich implements the state machine.

Microprocessor 107 as Bus Master and Bus Slave: FIGS. 3-8

As indicated in the "Description of the Prior Art" above, amicroprocessor is a bus master when it controls access to a bus and abus slave when it must request access from a bus master before it canhave access to the bus. Microprocessor 107 may be either a bus master ora bus slave, and consequently may be advantageously employed in manydifferent system configurations. FIG. 3 shows a configuration in whichone microprocessor 107 is a bus master 301 and another is a bus slave303. Of course, a microprocessor 107 may be a bus slave in a system inwhich a device other than another microprocessor 107 is the bus masterand a bus master in a system in which devices other than othermicroprocessors 107 are bus slaves.

Both bus master 301 and bus slave 303 are connected to a bus like bus103. Included in bus 103 are address lines 311, data lines 313, andcontrol lines 315. Among the control lines are two bus access controllines, BUSREQL line 309 and BUSACKL line 307. BUSREQL line 309 isconnected to BUSREQ pin 205 of master 301 and slave 303, while BUSACKLline 307 is connected to BUSACK pin 203 of master 301 and slave 303. Asmay be seen from the arrows in FIG. 3, BUSREQ pin 205 of slave 303provides a bus request signal to BUSREQL 309, which in turn provides itto BUSREQ pin 205 of master 301, while BUSACK pin 203 of master 301provides a bus acknowledgement signal via BUSACKL 307 to BUSACK pin 203of slave 303. When slave 303 requires access to bus 103, it places thebus request signal on line 309; when bus master 301 determines thatslave 303 may have access, bus master 301 responds to the bus requestsignal with a bus access signal on line 307; when slave 303 receives thebus access signal while it is sending the bus request signal, it knowsthat it has access to the bus and may send or receive data.

Whether a microprocessor 107 is a bus master, i.e., receives the busrequest signal and sends the bus acknowledge signal, or a bus slave,i.e., does the reverse, is determined by the input to M/S pin 207. Ifthe input is a logic 1, microprocessor 107 is a bus master; if it is alogic 0, microprocessor 107 is a bus slave. Generally, microprocessor107's status as a bus master or bus slave will not change, andconsequently, M/S pin 207 is generally tied to VCC in a master 301 andto ground in a slave 303; however, the input to pin 207 could be madeswitchable and microprocessor 107 could be switched between masterstatus and slave status as required by system 101 to whichmicroprocessor 107 belongs.

More than one microprocessor 107 operating as a slave 303 may beattached to a bus 103; however, in the presently-preferred embodiment,any contention among the slaves 303 for access to the bus must beresolved by priority logic connected between BUSACKL 307 and BUSREQL 309lines in bus 103 and the corresponding BUSACK 203 and BUSREQ 205 pins ofthe microprocessors 107 operating as slaves 303. The priority logicwould respond to the simultaneous assertion of the bus request signal bymore than one slave 303 by determining which of the slaves 303 hadpriority and generating the bus request signal on BUSREQL line 309 andwould respond to the bus acknowledge signal on BUSACKL line 307 byproviding the bus acknowledge signal to the slave 303 which hadpriority. In other embodiments, the priority logic may be incorporatedinto each microprocessor 107 operating as a slave 303; for example, aslave 303 may receive as well as send the bus request signal and maysend the bus request signal only if it is not already receiving it froma slave 303 with higher priority.

Implementation of Master-Slave Control Logic: FIG. 4

As previously indicated, the control logic for a preferred embodiment ofmicroprocessor 107 was implemented by providing "C" programs whichemulated the states of various subsystems of microprocessor 107 to thesilicon compiler used to produce the masks for the microprocessor IC.FIG. 4 is a state diagram for that portion of the I/O subsystem ofmicroprocessor 107 which is relevant to the interaction of I/Ooperations with inputs from MASTER/SLAVE pin 207, BUSACK pin 203, andBUSREQ pin 205. The following discussion will first present an overviewof I/O operations as they are performed by the master and slave, andwill then explain the operations in detail using the state diagram ofFIG. 4.

As will be explained in more detail later, microprocessor 107 includes apipeline for executing instructions and a pipeline for performing I/Ooperations; consequently, more than one I/O operation may be pending atany given time. The I/O instructions executed by microprocessor 107 fromthe time a given I/O instruction is executed to the time at which thereare no more I/O instructions in the instruction pipeline or the I/Opipeline is termed in the following a sequence of I/O instructions. Therules for performing I/O operations are the following:

Master 301

Master 301 may begin executing a sequence of I/O instructions wheneverit is not receiving an active bus request signal on BUSREQ pin 205.

If master 301 is executing a sequence of I/O instructions when itreceives an active bus request signal, it finishes the I/O instructionfor which it is currently performing a memory read or write operationand then provides an active bus acknowledge signal on BUSACK pin 203.The bus acknowledge signal remains active until slave 303 ceases sendingthe active bus request signal.

If master 301 is not executing a sequence of I/O instructions when itreceives the active bus request signal, it immediately provides theactive bus acknowledge signal.

Slave 303

Slave 303 may begin executing a sequence of I/O instructions when it isproviding an active bus request signal to master 301 and is receiving anactive bus acknowledge signal in return.

Slave 303 continues executing the sequence of I/O instructions eitheruntil it is done or until master 301 ceases providing the active busacknowledge signal. In the first case, when slave 303 is finished, itceases providing the active bus request signal, and master 301 respondsthereto by ceasing to provide the active bus acknowledge signal. In thesecond case, slave 303 responds when the bus acknowledge signal goesinactive by first finishing the I/O instruction for which it iscurrently performing a memory read or write operation and then ceasingto provide the active bus request signal for one bus cycle. Thisresponse permits a master 301 which is not a microprocessor 107 toregain control of bus 103 from a microprocessor 107 operating as a slave303.

As may be seen from the foregoing, master 301 has access to bus 103whenever slave 303 is not requesting access and can also force slave 303to give up bus 103 at any time, but slave 303 has access only when slave303 is requesting access and master 301 has responded with the BUSACKsignal.

FIG. 4 is a standard state diagram. Each circle represents one of thestates of the I/O subsystem of microprocessor 107, and the arrowsindicate transitions from one state to the next. The legends on thearrows indicate the conditions which bring about the transitionsindicated by the arrows, and the legends inside the circles are thenames of signals generated by that state. The diagram has beensimplified to show only those conditions and signals which are directlyrelevant to microprocessor 107's roles as bus master 301 and bus slave303. The conditions of interest are the following:

DT: DTACK signal received on pin 211.

IO: sequence of I/O operations to do.

HB: microprocessor 107 has access to bus 103.

M: microprocessor 107 is a master 301.

NIO: microprocessor 107 has further I/O pending.

S: microprocessor 107 is a slave 303.

Negations of these conditions have the obvious meanings.

The signals of interest are BR, which slave 303 outputs on BUSREQ pin205, and BA, which master 301 outputs on BUSACK pin 203. Of course, ifmaster is in a state which outputs BR, the signal will not appear on pin205. The same holds for a slave in a state which outputs BA. On theinput side, the results of BR and BA appear in HB and HB: Ifmicroprocessor 107 is a master 301, HB means either that master 301 isnot receiving an active bus request signal or that it is, but isfinishing an I/O operation and has not yet provided an active busacknowledge signal. If microprocessor 107 is a slave 303, HB means thatslave 303 is providing an active bus request signal and is receiving anactive bus acknowledge signal. The meaning of HB is the negation of HBin each of the above cases, i.e., in the case of master 301, that slave303 has bus 103, and in the case of slave 303, that master 301 has bus103.

Continuing with the details of FIG. 4, the starting state is reset 413which is entered in response to a RESET signal received in a pin ofpreferred embodiment 201. The next state is always state 400. As long asmicroprocessor 107 is performing no I/O operations on bus 103, itremains in state 400, as indicated by the arrow labeled IO. What happenswhen microprocessor 107 has an I/O operation to perform depends onwhether microprocessor 107 is a master 301 or a slave 303.

I/O Operations by Master 301

If microprocessor 107 is a master 301, it has bus 103 unless slave 303has it. In the first case, indicated by the arrow labeled IO, HB, M, thenext state is state 401, which starts a sequence of I/O operations byputting the signals required for the I/O operation on bus 103. If thesequence consists of only a single I/O operation, there are no pendingI/O operations, and as indicated by the arrow labeled NIO, the nextstate is 409, which completes any sequence of I/O operations. As shownby the arrow which loops back into state 409 and the arrow to state 418,master 310 remains in state 409 until one of three things happens:master 301 receives a DTACK signal on pin 211 indicating that memory 102has either received or provided the data specified in the most recentI/O operation of the sequence, until master 301 has another I/Oinstruction to execute, so that further I/O is pending, or until master301 receives a BUSREQ signal and consequently loses bus 103. When DTACKhas been received, as indicated by DT, but no further I/O is pending,the next state is state 400. If further I/O is pending before the DTACKsignal is received, the next state is 402; if the further I/O comes inat the same time the

DTACK signal is received, the next state is 401. If master 301 loses bus103, the next state is 418, in which master 301 provides the BUSACKsignal, and the state following that is state 411, in which master 301remains until it again has bus 103, as indicated by the looping arrowwith HB. While master 301 is in state 411, it continues to provide theBUSACK signal, as indicated by the BA. When master 301 again has bus103, it goes to state 401.

If the sequence consists of more than one I/O operation, as indicated byNIO, the next state after state 401 is state 402, which places thesignals for each following I/O operation on bus 103 and waits for theDTACK signal, as indicated by the arrow which loops back. As long as NIOindicates that the sequence of I/O operations is not finished and master301 has the bus, i.e., has not received a BUSREQ signal, the state whichmaster 301 enters after it receives the DTACK signal is state 405, whichsimply returns to state 402. When no further I/O is pending, asindicated by NIO, the state which follows state 402 depends on whethermaster 301 still has the bus or has received a BUSREQ signal. In thefirst case, the next state is 401, which places the last I/O operationof the sequence on bus 103 and then goes to state 409, as previouslyindicated. In the second case, the next state is 18, and master 301proceeds as indicated in the description of that state and state 11above.

When master 301 receives a BUSREQ signal from slave 303 while master 301still has I/O pending, that signal takes effect in state 402. Sincemaster 301 has now lost the bus, the next state is 419, in which master301 supplies the BUSACK signal, permitting slave 303 access to bus 103.The next state is 412, in which master 301 remains as long as slave 303has bus 103. During that period, master 301 continues to output theBUSACK signal. When slave 303 relinquishes bus 103, master 301 returnsto state 405 and the remainder of the sequence is executed as describedabove.

When master 301 has an I/O instruction pending but slave 303 has bus103, the state following state 400 is state 410, as indicated by thelabel IO, HB on the arrow. Master 301 remains in state 410 until one oftwo things occurs: master 301 again has the bus, i.e., slave 303inactivates its bus request signal, or additional I/O has come in.Beginning with the first situation, if there is only one I/O operationpending when master 301 again has the bus, as indicated by HB, NIO, thenext state is 401, and the I/O operation proceeds as indicated above fora sequence of one I/O operation. If there is already another I/Ooperation pending, as indicated by HB, NIO, the next state is 414, whichplaces the signals for the first I/O operation of the sequence on bus103. The next state is state 402, which proceeds with the remaining I/Ooperations of the sequence as described above. If master 301 still doesnot have the bus when the next I/O instruction comes in, as indicated byHB and NIO, the next state is 413. Master 301 remains in that stateuntil it has the bus, and then goes to state 414, from whence it goes to402 as described above.

I/O Operations By Slave 303

Before slave 303 can perform I/O operations, it must place the busrequest signal on bus 103 and master 301 must respond with a busacknowledge signal. If slave 303 has not had any I/O to do and has spentseveral cycles in state 400, this is straightforward enough: when slave303 has I/O to do, it goes to state 417; in that state, it outputs thebus request signal; if it receives the bus acknowledge signal in thatstate, it goes to state 401, from which the I/O operation proceeds asdescribed above, except that, as indicated above, master 301 may removeslave 303 from bus 103 by inactivating the bus acknowledge signal. Whathappens in that case will be explained in detail below. If slave 303does not receive the bus acknowledge signal in state 417, it goes to410, where it remains until it has bus 103 or until there is more thanone I/O operation in the sequence of I/O operations. When slave 303 getsbus 103, what happens next depends on whether there is more than one I/Ooperation in the sequence. If there is only one, the next state is 401,and the I/O operation is performed as described above. If there is morethan one, the next state is 414, which performs the first I/O operationof the sequence. The following state is 402, from which the rest of thesequence is dealt with as described above. If slave 303 has more thanone I/O operation in the sequence before it receives bus 103, the statefollowing state 410 is state 413. Slave 103 remains in that state untilit gains access to bus 103; when it gains access, it goes to state 414and proceeds as indicated above. In all cases, when slave 303 reachesstate 400, it inactivates the bus request signal.

When master 301 inactivates the bus acknowledge signal to remove slave303 from bus 103, the inactivation takes effect when either state 409 orstate 402 is reached following the inactivation. When the inactivationtakes effect in state 409, the next state is state 400 if there is nofurther I/O. If there is further I/O pending, the next state is 418,followed by state 411. Slave 303 remains in state 411 until it again hasbus 103 and then proceeds to state 401 to begin completing the pendingof I/O operations. When the inactivation takes effect in state 402, ifthere is no pending I/O, the next state is 418, followed by state 411.From there, slave 303 proceeds as indicated above. If there is pendingI/O when the inactivation takes effect in state 402, the next state is419, followed by 412. Slave 303 remains in state 412 until it againreceives access to bus 103; at that point, it returns to state 405 andthe pending I/O is finished as already explained.

The only other case remaining to be considered is when slave 303 entersstate 400 from state 409, inactivates the bus request signal, and againhas I/O to do before it leaves state 400. In this situation, slave 303cannot simply immediately reactivate the bus request signal, but insteadmust wait until master 301 has inactivated the bus acknowledge signal.To accomplish this, slave 303 goes to state 415, where it remains eitheruntil master 301 deactivates the bus acknowledge signal or until thereis more than one I/O operation in the sequence.

If deactivation occurs with only one I/O operation in the sequence,slave 303 goes to state 410, where it activates the bus request signal.Slave 303 remains in state 410 until it either receives the active busacknowledge signal from master 301 or there is more than one I/Ooperation in the sequence. If the first event occurs before the other,slave 303 goes to state 401 and does I/O from that state as describedabove; if the second occurs before the first, slave 303 goes to state413 and waits there until it has the bus, whereupon it enters state 414and does I/O starting from that state as described above; if both eventshappen in the same cycle, slave 303 goes directly to state 414.

If deactivation occurs in the same cycle of slave 303 in which thesequence gets more than one I/O operation, the next state is 413; slave303 activates the bus request signal in that state and waits in thestate until it receives the bus acknowledge signal; it then proceeds tostate 414 to begin I/O as described above. If the sequence gets morethan one I/O operation before the bus acknowledge signal is deactivated,the next state is 416, where slave 303 waits until the bus acknowledgesignal is deactivated. When this happens, slave 303 goes to state 413,where it activates the bus request signal and waits for the bus as justdescribed.

Timing Diagrams for the Bus Request and Bus Acknowledge Signals: FIGS.5-7

FIGS. 5 through 7 are timing diagrams showing the timing of the busrequest and bus acknowledge signals. FIG. 5 shows the timing of thesignals when a master 301 is not itself doing I/O and receives a busrequest signal from a slave 303. Events in the timing diagram areregulated by CLOCK signal 501, which is provided from bus 103 on CLOCKpin 213. In preferred embodiment 201, the maximum frequency of CLOCK is20 MHz. Bus 103 represents all of the signals on bus 103 except theother signals shown in FIG. 5. The bus request signal appears as BUSREQ503 and the bus acknowledge signal appears as BUSACK 505. Both signalsare active low in the preferred embodiment. As shown in FIG. 5, whenmaster 301 is not doing I/O and slave 303 activates BUSREQ 503, master301 responds by activating BUSACK 505; when slave 303 is finished withits I/O and deactivates BUSREQ 503, master 301 responds by deactivatingBUSACK 505. In preferred embodiment 201, the period indicated by 21 isthe set up time required by master 301 to recognize a change in BUSREQ503, the period indicated by 22 is the time required to activate BUSACK505 thereafter, and 23 is the time to deactivate BUSACK 505. The timesare 12 ns, 32 ns, and 36 ns respectively.

FIG. 6 shows the timing when master 301 is doing I/O of its own at thetime that slave 303 activates BUSREQ 503. As can be seen from thatfigure, master 301 waits until it is done with the I/O operation forwhich it is currently performing memory operations before it activatesBUSACK 505. The bus cycles for the I/O operations appear in FIG. 6 asBUS CYCLE 1 and BUS CYCLE 2. The period indicated by 20 is the timerequired for BUSACK 505 to reach either an active or an inactive state;in a preferred embodiment, the maximum time is 32 ns.

FIG. 7 shows the timing from the point of view of slave 303. After slave303 activates BUSREQ 503, master 301 responds by activating BUSACK 505,and thereupon slave 303 begins doing I/O operations. If master 301inactivates BUSACK 505 while slave 303 is doing I/O operations, slave303 ceases doing I/O operations and inactivates BUSREQ 503 for one clockcycle, permitting master 301 access to bus 103. The period indicated by1 is the time required for BUSREQ 503 to reach either an active orinactive state, and that indicated by 2 is the set up time required byslave 301 before it can recognize the activation of BUSACK 505 by master303. In preferred embodiment 201, the maximum time for period 1 is 30 nsand that for period 2 is 10 ns.

Master-Slave Logic: FIG. 8

FIG. 8 is an overview of the logic implementing the I/O state machinejust explained. I/O state logic (IOSL) 813 receives inputs from DTACKpin 211 and M/S pin 207 and receives inputs from and provides outputs toBUSACK pin 203 and BUSREQ pin 205. Additionally, I/O state logic 813receives IO input 815, indicating that microprocessor 107 has one ormore I/O operations to perform, and provides HB signal 819, indicatingwhether microprocessor 107 presently has the bus, to itself. Within I/Ostate logic 813, master logic 801 provides HB signal 819 in response toMS signal 821 until it receives BR input 811 from pin 205, whereupon itresponds by providing BA signal 803 to pin 203 and ceasing to provide HBsignal 819. Slave logic 805 provides BR signal 803 to pin 205 inresponse to MS input 819, I/O input 815 or NIO input 817, indicatingthat there is I/O to do, and responds to BA signal 805 from pin 203 byproviding HB signal 819.

As further shown in FIG. 8, the line BA 803 carries the bus acknowledgesignal to be output to pin 203; driver 804 which outputs the signal topin 203 is turned on and off by MS signal 821, thus, when that signalindicates that microprocessor 107 is a bus master, driver 804 is turnedon; otherwise it is turned off. Bus acknowledge signals received onBUSACK pin 203 are provided to line 805 by driver 806, which is alwayson. Implementation 805 of BUSREQ pin 205 is similar, except that outputof BR line 807 is controlled by driver 808, which is turned on only whenthe MS signal indicates that microprocessor 107 is a bus slave.

Bus Signals with Controlled Final States: FIGS. 9 and 10

Like many modern circuits, preferred embodiment 201 of microprocessor107 employs three-state drivers to drive lines of bus 103. A three-statedriver can put an output line in one of three states: logic active,logic inactive, or off. The logic active and inactive states areexpressed by different voltage or current levels, depending on the kindof circuitry; the off state is expressed by a high impedance, i.e., fromthe point of view of other devices attached to the bus, the driver is nolonger attached to the bus.

A difficulty with three-state drivers is that the state of the line whenthe three-state driver is turned off is the last state which the driverplaced on the line prior to turning off. Thus, if the driver places theline in the active state and then turns off, the line remains in theactive state for awhile, even though it is no longer being driven. Thedifficulty with this situation is that another device on the bus whichresponds to the line cannot distinguish between an active state beingplaced on the line by the driver and one remaining on the line after thedriver has been shut off and may respond to an active state remaining onthe line after the driver has been shut off in the same way that itresponds to one being placed on the line by the driver. To prevent thisproblem, the an has typically brought a line driven by a three-statedriver to an inactive state 1/2 clock cycle before turning thethree-state driver off. The difficulty with this solution is of coursethe fact that an extra 1/2 cycle is required to turn a three-statedriver off.

Preferred embodiment 201 of microprocessor 107 includes circuitry whichsolves the above problem by using feedback from the driver's output lineto ensure that the driver has placed the line in an inactive statebefore turning the line off. FIG. 9 shows the effect of such circuitryon two signals 901 and 903 of preferred embodiment 201. The figure is atiming diagram for a byte read operation. In the operation, preferredembodiment 201 of microprocessor 107 performs a read of a byte of datafrom memory 102 across bus 103. Bus lines involved include address fines311, data lines 313, and control lines carrying the CLOCK signal, the ASsignal, the R/W signal, the ERE signal, the DTACK signal, and the BUSERRsignal. The significance of these signals was explained in thediscussion of FIG. 2 above. Two signals, AS and ERE, are of particularinterest here. AS is provided by microprocessor 107 to memory 102 toindicate that the address on address lines 311 is valid; ERE is providedby microprocessor 107 to memory 102 to indicate that the even byte ofthe word specified by the address on address lines 311 is to be read.Both signals are active low.

During the read operation, the signals behave as follows: Both AS andERE remain off until the cycle of CLOCK 501 in which there is a validaddress on address lines 907. At that point, microprocessor 107 placesboth AS and ERE in the inactive state. When CLOCK 501 goes low, AS goesto the active state, and when CLOCK 501 next goes high, ERE goes to theactive state. Both remain active until memory 102 has placed the data onbus 103. When CLOCK 501 goes high after the data has been placed on bus103, both AS and ERE are placed in the inactive state. As may be seen atreference number 905, the two pins are then immediately turned off. Theeffect of the invention is to guarantee that the rise to the inactivestate shown at reference number 905 will occur regardless of the lengthof time between the point at which the pins are placed in the inactivestate and the point at which they are turned off, and thereby toguarantee that memory 102 will not mistakenly respond to active AS andERE signals remaining on bus 103 after a microprocessor 107 has ceaseddriving the signals.

FIG. 10 shows circuit 1001 used in preferred embodiment 201 ofmicroprocessor 107 to produce the rise to the inactive state shown atreference number 905. Circuit 1001 is a modification of a standardbidirectional buffer circuit 1041, formed by driver 1005 for driving asignal received from the internal logic of microprocessor 107 onto a pinthereof and driver 1009 for driving a signal received on the pin intothe internal logic of microprocessor 107. The main inputs to circuit1001 are line 1003 carrying SGNL, a signal such as AS or ERE, and line1029 carrying EN₋₋ SGNL, a signal which enables the output of SGNL to apin of preferred embodiment 201. The output from circuit 100 is line1007 carrying EX₋₋ SGNL to the pin. Output of SGNL to line 1007 iscontrolled by driver 1005. Driver 1005 is a three-state driver and isturned on and off by signals input at points ST and ST. When the inputto ST is high and that to ST is low, driver 1005 is on; when the reverseis true, driver 1005 is off. The signals input to ST and ST are providedby circuitry 1002 consisting of driver 1009 connected to line 1007 andhaving line 1011 as its output, NAND gates 1015 and 1023, flip-flop1027, and inverters 1033 and 1037. EN₋₋ SGNL is the inversion of EN₋₋SGNL; thus, when EN₋₋ SGNL is inactive, indicating that driver 1005 isto be turned off, EN₋₋ SGNL is active. When that is the case, circuitry1002 operates to ensure that EXSGNL is in its inactive state (in thiscase, high) before driver 1005 is turned off.

Operation of circuitry 1002 is as follows: When microprocessor 107 isinitialized, RESET goes low, which results in a high output at line1025. That in turn sets the Q output of flip-flop 1027 to a known state,namely 0. In that state, QEN 1031 is low, EN 1035 is high, EN 1039 islow, and driver 1005 is off. When microprocessor 107 turns driver 1005on, it activates EN₋₋ SGNL, which is received on line 1029 at the Sinput of flip-flop 1027. The active EN₋₋ SGNL sets flip-flop 1027 to 1and thus, the Q output of flip-flop 1027 goes high, QEN on line 103 1 ishigh, EN on line 1035 is low, EN on line 1039 is high, and driver 1005is turned on. At the same time, EN₋₋ SGNL goes low at the input to NANDgate 1015, which means that the output of that gate at line 1017 is highregardless of the state of line 1011. Line 1017 is one input to NANDgate 1023; the other inputs, TEST 1021 and RESET 1019 are high duringnormal operation of the circuitry; consequently, the output of NAND gate1023 to line 1025 is low; that line is connected to the R input offlip-flop 1027, flip-flop 1027 is therefore not reset as long as EN₋₋SGNL is high, and driver 1005 remains on.

When EN₋₋ SGNL goes low, the Q output of flip-flop 127 remains highuntil the signal received at the R input of flip-flop 127 goes high.That happens only after SGNL has gone high and driver 1005 has respondedthereto by driving EN₋₋ SGNL 1007 high on line 1007. As indicated above,as long as EN₋₋ SGNL is low, the state of EXSGNL has no effect on thestate of the R input to flip-flop 1027; when EN₋₋ SGNL goes high, thestate of EXSGNL determines the state of the R input; thus, if EXSGNL islow, the output of NAND gate 1015 remains high and the output of gate1023 to the R input of flip-flop 1027 remains low; if, on the otherhand, EXSGNL is high, the output of NAND gate 1015 goes low, the outputof NAND gate 1023 goes high, flip-flop 1027 is reset so that the Qoutput and QEN go low, EN goes high, and EN goes low, turning off driver1005. The circuit thus guarantees that EXSGNL will go high before driver1005 turns off.

As will be apparent to one skilled in the art, many variations oncircuit 1001 are possible. For example, a variation may be constructedwhich requires that EXSGNL go low before driver 1005 is turned off;another variation may be built in which a low-high-low pulse derivedfrom EN₋₋ SGNL drives SGNL high, so that EXSGNL is high before driver1005 is turned off regardless of the prior state of SGNL.

The Instruction Architecture of Microprocessor 107: FIG. 11

The innovations in microprocessor 107 described thus far have concernedthe interface between microprocessor 107 and a system 101 in which themicroprocessor 107 is employed; other innovations concern certaininstructions executed by microprocessor 107. The following discussionwill first provide an overview of the instruction architecture ofmicroprocessor 107 and then discuss those instructions which are ofparticular interest in detail.

FIG. 11 shows instruction architecture 1101 of microprocessor 107, i.e.,the figure shows microprocessor 107 as it appears to a programmer who iswriting code consisting of instructions from microprocessor 107'sinstruction set. Each of the registers and other components ofinstruction architecture 1101 represents a logical device whose behaviormay be specified in instructions of the instruction set. The descriptionbegins with the registers.

REGISTERS

There are 256 general registers 1103 (0 to 255) and 14 special purposeregisters in instruction architecture 1101.

GENERAL REGISTERS 1103

The 256 general registers 1103 make up general register file 1104.General registers 1103 are employed generally to store data beingprocessed within microprocessor 107. Each general register is 24 bitswide, but the registers may be subdivided for addressing purposes.Addressing of general registers 1103 is shown in FIG. 11A. Each generalregister may be specified directly by an address between 0 and 255 ormay be specified by means of an offset from the value contained in framepointer (FRMPTR) register 1117. Within the addressed register, thefollowing subdivisions may be specified:

low byte 1157: bits 0-7 of the addressed register;

middle byte 1159: bits 8-15 of the addressed register;,

high byte 1161: bits 16-23 of the addressed register;

low word 1163: bits 0-15 of the addressed register;

high word 1165: bits 08-23 of the addressed register, and

entire register 1167: bits 0-23 of the addressed register.

With reference to internal dam bus (IDB) 1115, the general registers canbe either a source (read operation) or a destination (write operation).When a general register 1103 is a source, the specified portion of thegeneral register is output to the least significant bits of internaldata bus 1115; the remaining bits of bus 1115 are set to 0; when ageneral register 1103 is a destination, the number of bits of internaldata bus 1115 required for the portion are written to the portion,beginning with the least significant bit of internal data bus 1115. Asmay be seen from the foregoing, it is possible to write any byte or wordfrom one general register 1103 to any byte or word of another generalregister 1103 without disturbing the remaining portions of either thesource or destination general registers 1103.

Continuing with the special purpose registers, most of these registersare 24 bits wide. Generally, all of the special registers can be eithersource or destination for most instructions. One exception isaccumulator (ACC) 1109--it cannot be a direct destination for manyregister moves.

PSW 1119

PSW 1119 is the Processor Status Word register. The format of PSW is asfollows:

    ______________________________________                                         ##STR18##                                                                    The meaning of the bits is given in the following table:                      Mnemonic                                                                              Full Name Explanation                                                 ______________________________________                                        C       Carry     Carry flag from ALU operations.                             Z       Zero      Zero flag from ALU operations.                              EX      Enable    Enables external interrupts.                                        eXternal                                                              ET      Enable    Enables internal timer interrupts.                                  Timer                                                                 L       LIFO      Set when the internal LIFO                                          interrupt overflows/underflows.                                       F       FRMPTR    Set when FRMPTR add/sub                                             interrupt overflows/underflows.                                       B       Bus Error exception                                                                      ##STR19##                                                  A       Address   Set when an odd address is used for                                 Error     word or long I/O.                                                   exception                                                             X       External  Set when an external interrupt is                                   Interrupt recognized.                                                 I       Illegal   Set when an illegal instruction is                                  instruction                                                                             decoded.                                                    T       Timer     Set when the internal timer interrupts.                             interrupt                                                             SWB     Byte swap Set to reverse the effect of I/--M                                  bit                                                                   ______________________________________                                    

At reset, all bits in PSW 1119 are cleared to zero. Thus, the Carry andZero flags are cleared and the external interrupts and timer interruptsare not enabled.

PSW 1119 may be read or written just like the other special-purposeregisters, with a write often being used to change one of the interruptenable flags or the SWB bit. However, for bits 4-10, the interruptstatus flag bits, a move instruction can only clear these bits--theycannot be set by a move instruction. In other words, writing zeros willclear the interrupt status bits, and writing ones will leave theinterrupt status bits unchanged.

Therefore, to clear a particular interrupt status bit, the interruptstatus bits which it is desired to NOT clear should be set to a 1 in theword which will be written to PSW 1119 to modify it. The interruptstatus bit which is desired to be cleared should have a 0 in thecorresponding bit position of the word written to PSW 1119.

ACC 1109

ACC 1109 is a 24 bit register. It stores the result of operations by ALU1107. In the case of 8 or 16 bit ALU operations, all 24 bits of ACC 1109are affected, but only the 8 or 16 least significant bits will havevalid information. With reference to internal data bus 1115, ACC 1109 isa source only, but an instruction exists to allow loading ACC 1109 froma general register 1103 by having ALU 1107 execute no operation on itsinput data. Also, ACC 1109 may be loaded from B register 1105, again byhaving ALU 1107 perform no operation on its input value.

B Register 1105

B register 1105 is a 24 bit register. It provides one of the operands toALU 1107 for ALU operation instructions.

ALR 1145

ALR 1145 is a 24 bit address latch. It is used to hold the effectiveaddress for read operations of system memory 102.

ALW 1146

ALW 1146 is a 24 bit address latch. It is used to hold the effectiveaddress for write operations to system memory 102.

IL 1149

IL 1149 is a 24 bit register used to hold the input data from anexternal system memory read operation. The instruction set defines an 8bit read, a 16 bit read and a 24 bit read which actually does two systemreads to consecutive address locations in system memory 102.

OL 1151

OL 1151 is a 24 bit register used to hold the output data for anexternal system memory write operation. The instruction set defines an 8bit write, a 16 bit write and a 24 bit write which actually does twosystem writes to consecutive address locations.

FRMPTR 1117

FRMPTR 1117 is an 8 bit register. General registers 1103 may beaddressed by offsets ranging from +127 to -127 from the value stored inFRMPTR 1117. FRMPTR 1117 may be read and written from internal data bus1115, and consequently, may be saved and set to a new value when asubroutine is entered and restored to its old value on return from thesubroutine. This in turn makes it possible to use general registers 1103as a stack of local variables used by a subroutine.

PC 1127

PC 1127 is a 16 bit program counter. It is used to control the programflow through access to the instructions stored in both internal ROMand/or private memory 108. On each clock cycle, the output of the PC istemporarily stored in a 16 bit latch. From that latch, it can be storedin the last-in-first-out (LIFO) stack 1125. This stack is used toimplement subroutine returns and interrupt returns. Input to PC 1127 isfrom LIFO 1125 and internal data bus 1115. Output is to LIFO 1125, IDB1115, and private data bus 108.

Note: When performing a move from PC instruction, since it is only 16bits wide, the 6 bits (21-16) above the PC bits will contain the currentvalue of the internal stack pointer, which is really a count of thenumber of addresses on the internal stack. These bits are provided sothat during a post-mortem analysis of a program with a fatal error, itis possible to tell how many addresses to pop off of LIFO 1125 forexamination. A move to PC will only affect the 16 bits of the PC.

IT 1123

IT 1123 is the 24 bit internal timer register. It contains the valueused to initialize and reload the down-counter when it has reached zeroand possibly generated an interrupt.

STACKREG 1133

STACKREG 1133 is a 16 bit register used to store the output from LIFO1125 when a "popstack" instruction is executed. The popstack instructionand STACKREG 1133 are intended to be used only for the interrupt handlerfor catastrophic exceptions--i.e. to handle FRMPTR or LIFOoverflow/underflow exceptions, or Bus Error or Address Error exceptions.STACKREG 1133 allows the contents of LIFO 1125 to be examined during apost-mortem analysis to determine why the catastrophic failure occurred.

Instructions in Microprocessor 107

Certain aspects of the instructions executed by microprocessor 107 areof particular interest. Discussion of these aspects will begin with adescription of instruction execution generally in microprocessor 107 andwill then deal with the aspects as they appear in certain of theinstructions.

Instruction Execution in Microprocessor 107: FIG. 19

One technique which is widely used to speed up instruction execution inprocessors is pipelining. The execution of any instruction has a numberof phases. For example, with a MOVE instruction which moves data fromone register to another, it is typically necessary to fetch the MOVEinstruction, to decode it to determine that it is a MOVE instruction andto determine which register is the source of the data being moved andwhich the destination, and to actually execute the instruction by movingthe data from the source register to the destination register. Wheninstruction execution is pipelined, the phases of execution areperformed in parallel on different instructions. For instance, if apipelined processor is executing three instructions in the order n1, n2,and n3, it may be simultaneously performing the execution phase on n1,the decode phase on n2, and the fetch phase on n3.

Microprocessor 107 has two pipelines. The first pipeline is theinstruction pipeline. The execution of every instruction is divided intothree phases, fetch, decode, and execute, and these phases are performedin parallel. Consequently, microprocessor 107 is generally able toexecute one instruction per cycle of CLOCK signal 501. The secondpipeline is an I/O instruction pipeline, which handles the later phasesof execution of I/O instructions independently of the instructionpipeline.

FIG. 19 shows the operation of the two pipelines. The operation of eachpipeline is shown in the form of a table, with rows corresponding to thephases of instruction execution and columns corresponding to cycles ofCLOCK 501. Table 1901 represents the instruction pipeline and table 1909represents the I/O pipeline. As already mentioned, there are threephases of execution in instruction pipeline 1901: fetch (F) phase 1903,decode (De) phase 1905, and execute (E) phase 1907. There are two phasesin I/O pipeline 1909: a load phase (L) 1911, in which the addressrequired for the operation is loaded into a register in the I/Osubsystem of microprocessor 107, indicated in FIG. 11 by box 1135, andan execute I/O phase (EIO) 1913 in which the address and the data aretransferred via bus 103. EIO phase 1913 lasts until the transfer of datais complete, i.e. until the DTACK signal is received from memory 102. Ata minimum, EIO phase 1913 lasts two clock cycles for byte and word readsand writes and four clock cycles for byte and word read-modifies-writesand pointer reads and writes. Additional cycles are required ifmicroprocessor 107 must wait for access to bus 103 or if memory 102cannot immediately respond.

FIG. 19 shows the execution of a sequence of four instructions, SysW1, asystem write instruction which writes data to memory 102 from inputlatch 1149, SysW2, a second such instruction which writes data fromoutput latch 1151, NIO1, which may be any instruction which is not anI/O instruction, and NIO2, a second such instruction. In cycle n,instruction pipeline 1901 executes F phase 1903 of SysW1; in cycle n+1,it executes F phase 1903 of SysW2 and De phase 1905 of SysW1; in cyclen+2, it executes F phase 1903 of NIO1, De phase 1905 of SysW2, and Ephase 1907 of NIO1, and so forth.

I/O pipeline 1909 receives SysW1 in cycle n+2, and performs load phase L1911 on it in the same cycle. In cycle n+3, I/O pipeline 1909 performsphase L on SysW2 and EIO phase 1913 on SysW1. That phase lasts twocycles for SysW1, or until cycle n+4. Consequently, SysW2 cannot enterEIO phase 1913 until cycle n+5; EIO phase 1913 lasts more than threecycles for SysW2, and SysW2 is still in that phase in cycle n+7, thelast cycle shown in FIG. 19.

Since I/O pipeline 1909 operates independently of instruction pipeline1901, execution of instructions in instruction pipeline 1901 need notwait until EIO phase 1913 is completed for SysW1 or SysW2. While the I/Ois going on, instruction pipeline 1901 executes NIO1 and NIO2. Ofcourse, it may at times be necessary to stop instruction pipeline 1901to wait for I/O pipeline 1909. One such situation would occur if therewere already an I/O instruction in L phase 1911 when a following I/Oinstruction entered E phase 1907; another such situation would occur ifan NIO instruction required data in its E phase 1907 which was beingprovided by an I/O instruction which was still being executed by I/Opipe 1909.

Instruction Formats: FIG. 12

FIG. 12 shows the MOVE instructions executed by microprocessor 107. Asmay be seen from that figure, microprocessor 107's instructions are madeup of 24-bit instruction words 1201. Most of the instructions consist ofa single instruction word 1201; however, some MOVE instructions and LOADinstructions for 24-bit literal constants require two words. Except wheninstruction pipeline 1901 is halted, microprocessor 107 fetches oneinstruction word 1201 per clock cycle.

MOVE Instructions: FIGS. 12 and 12A

The MOVE instructions move data between registers of microprocessor 107.The register from which the data is moved is the source and the registerto which it is moved is the destination. There are four types of moveinstructions:

Type 0, in which both the source and the destination are generalregisters 1103;

Type 1, in which a general register 1103 is the source and one of thespecial registers is the destination;

Type 2, in which one of the special registers is the source and one ofthe general registers 1103 is the destination; and

Type 3, in which a special register is the source and another specialregister is the destination.

Type 0 instructions are shown in the portion of FIG. 12 labeled 1225.The instructions have two words, instruction word 1 (IW1) 1215 andinstruction word 2 (IW2) 1217. Beginning with IW1 1215, the mostsignificant 4 bits contain an operation code (OPCODE) 1203; the next 4bits are a don't care field 1205; the following 4 bits, TYPE 1207,specify the type of move instruction. In type 0, TYPE 1207 has the value0000; SIZE field 1209 indicates what portion of the contents of thesource general register 1103 is to be moved to the destination generalregister 1103. The codes and the portion of general register 1103 whichthey specify are the following:

    ______________________________________                                        SIZE code         Register Portion                                            ______________________________________                                        001               low byte 1157                                               010               middle byte 1159                                            100               high byte 1161                                              011               low word 1163                                               110               high word 1165                                              111               entire register 1167                                        ______________________________________                                    

The reference numbers refer to FIG. 11A.

The remaining 9 bits specify the general register 1103 which is thesource. F bit 1211 indicates whether the general register 1103 is beingspecified by means of an offset from frame pointer 1117; if it is,general register source field 1213 contains the offset; if it is not,general register source field 1213 contains the number of generalregister 1103. The 12 most significant bits of instruction word 2 1217are don't care bits 1219; bits 9-11 are SIZE field 1209; the code inSIZE 1209 in instruction word 2 1217 specifies the portion of thedestination general register 1103 which will receive the dam. If theportion specified by SIZE in instruction word 2 1217 is larger than thatspecified by SIZE in instruction word 1 1215, the most significant bitsare 0 filled; if the portion is smaller, the excess most significantbits are discarded. The remaining 9 bits contain F field 1211 andgeneral register destination field 1221, which together specifydestination general register 1103 in the same fashion as thecorresponding fields specify the source general register in instructionword 1 1215.

Execution of type 0 move instruction 1225 is shown in pipeline diagram1223. In cycle n, IW1 1215 is fetched; in cycle n+1, IW2 1217 is fetchedand IW1 1215 is decoded; the decoding involves computing which generalregister 1103 is the source register and reading the portion thereofspecified by SIZE field 1209 into a latch connected to internal data bus1115. In cycle n+2, IW2 1217 is deemed to determine which generalregister 1103 is the destination register, and in the same cycle, thecontents of the latch are read into the portion of the destinationgeneral register 1103 specified by size field 1209.

Move instructions of types 1 and 2 are shown in the portion of FIG. 12labeled 1233. The type 1 instruction has a general register 1103 as itssource and a special register as its destination; the type 2 instructionhas a special register as its source and a general register 1103 as itsdestination. Except for the value of type field 1207, the format of thetwo types is the same. The most significant 4 bits are opcode 1203; thenext four bits, SPR 1227, are a code specifying one of the specialregisters; then comes SIZE field 1209, and finally F field 1211 and GRfield 1229 specifying a general register 1103. Whether the special andgeneral registers are source and destination or vice-versa depends onthe value of TYPE field 1207. The effect of SIZE is the following:

If a general register 1103 is the source and the portion specified bySIZE 1209 is less than 24 bits, the specified portion is placed on theleast significant bits of IDB 1115 and the remaining bits are set to 0.

If a general register 1103 is the destination and the portion specifiedby SIZE 1209 is less than 24 bits, the specified portion is written fromthe least significant bits of IDB 1115.

Execution of a type 1 or 2 MOVE instruction in instruction pipeline 1901is shown in diagram 1231. At cycle n, the instruction is fetched; atcycle n+1, the source and destination are determined; at cycle n+2, thedata is written via IDB 1115 from the source to the destination.

The type 3 move instruction moves data from a source special register toa destination special register. The instruction is shown at referencenumber 1241 in FIG. 12A. The instruction has an opcode 1203 in bits20-23, a code in bits 16-19 specifying the destination special register,TYPE 1207 in bits 12-15, and a code in bits 0-3 specifying the sourcespecial register. Bits 4-11 are "don't care" bits. As implied by theabsence of SIZE field 1209, the instruction always moves 24 bits.Execution in the pipeline is substantially the same as for the type 1and 2 instructions.

Implementation of SIZE: FIG. 16

FIG. 16 is a logic diagram showing details of general registers 1103,ALU 1107, and ACC 1109 in preferred embodiment 201 of microprocessor107. As described above, SIZE field 1209 permits the programmer ofmicroprocessor 107 to specify any byte or contiguous 16-bit wordcontained in a general register 1103 or all 24 bits of the generalregister 1103 as a source or destination of data for a MOVE operation.When fewer than 24 bits are specified as a source, the specified data isplaced in the least significant bits of internal data bus 1115 and theremaining more significant bits of internal data bus 1115 axe zerofilled. When fewer than 24 bits are specified as a destination, thecontents of that many bits of internal data bus 1115 are moved to thedestination. Thus, if a type 0 MOVE instruction specified a move fromthe middle byte of general register 5 to the high byte of generalregister 10, the middle byte of general register 5 would be output tothe eight least significant bits of internal data bus 1115 and theremainder of internal data bus 1115 would be filled with zeros. Theeight least significant bits of internal data bus 1115 would then beinput to the high byte of general register 10. The move would leave thelow and middle bytes of general register 10 undisturbed.

The logic which performs this function is shown in portion 1104 of FIG.16. At the center of that portion are three 8×256 RAMs, low RAM CLRAM)1615, middle RAM (MRAM) 1613, and high RAM (HRAM) 1611, which containthe 256 general registers 1103. As expected from their names, low RAM1615 contains the least significant byte for each general register 1103,middle RAM 1613 contains the next most significant byte, and high RAM1611 contains the most significant byte.

Data is received in these RAMs from internal dam bus 1115 by means of adriver, low input driver (LB) 1609, and two input multiplexers, middleinput multiplexer (MIMUX) 1607, and high input multiplexer (HIMUX) 1605.Output from LID 1609 goes to LRAM 1615, output from MIMUX 1607 to MRAM1613, and output from HIMUX 1605 to HRAM 1611. HIMUX selects its inputfrom bits 0:7, 8:15, or 16:23 of internal data bus 1115, MIMUX 1607selects its input from bits 0:7 or 8:15, and LID 1609 has bits 0:7 asits only input. Selection of inputs for output by the two multiplexersand LID 1609 is by means of selection signals originating in destinationsize control (DSZ CTL) 1603, which in turn has as its input threedestination size lines (DSZ) 1601 carrying the value of SIZE field 1209in the second word of a type 0 MOVE instruction or in a type 2 MOVEinstruction, i.e., those instructions in which a general register 1103may be specified as a destination for data. Depending on the value ofSIZE field 1209, DSZCTL 1603 selects the low byte of internal data bus1115 for input to any of the three RAMs 1611, 1613, and 1615, the lowword of internal data bus 1115 for input to RAMs 1611 and 1613 or 1613and 1615, or the entire 24 bits of internal data bus 1115 for input toall three RAMs.

Data output from the three RAMs 1611, 1613, and 1615 goes first to threelatches corresponding to the three RAMs, high latch (HLA) 1617, middlelatch (MLA) 1619, and low latch (LLA) 1621. This arrangement permitsgeneral registers 1103 to be both sources and destinations in type 0MOVE instructions. Output from the three latches 1617, 1619, and 1621 isto internal data bus 1115 via three multiplexers, high outputmultiplexer (HOMUX) 1627, middle output multiplexer (MOMUX) 1629, andlow output multiplexer (LOMUX) 1631. Each of the three multiplexersreceives inputs from the latches and from accumulator register 1109. Thelatter set of inputs permits ACC 1109 to be a source of data foroperations by ALU 1643 or a source of data for a MOVE. Othermultiplexers which are not shown in FIG. 16 permit ACC 1109 to be adestination of data for a MOVE. HOMUX 1627 receives input only from HLA1617 and ACCO [23-16] and outputs to internal data bus 1115 [23-16];MOMUX 1629 receives input from ACCO [15-8] and from either MLA 1619 orHLA 1617 and outputs to internal data bus 1115 115-8];LOMUX 1631,finally, receives inputs from ACCO [7-0] and from HLA 1617, MLA 1619, orLLA 1621 and outputs to of internal data bus 1115 [7-0]. With any of thethree multiplexers 1627, 1629, and 1631, if no inputs are selected, themultiplexer outputs all "O's" to its byte of internal data bus 1115.Selection of input from latches 1617, 1619, and 1621 by the threemultiplexers is governed by signals provided by source size control (SSZCTL) 1625. These signals are in turn determined by the value of sourcesize (SSZ) 1623, which in turn is derived from the value of SIZE field1209 in the first word of the type 0 MOVE instruction or SIZE field 1209in the type 2 MOVE instruction, i.e., wherever a general register 1103is a source for a MOVE. Thus, when SIZE specifies either the low,middle, or high byte of the source general register 1103, that byte isselected by LOMUX 1631 from the one of latches 1617, 1619, and 1621which contains the byte and output to the least significant 8 bits ofinternal data bus 1115, while the remaining two muxes 1627 and 1629output O's to the 16 most significant bits of internal data bus 1115.When SIZE specifies either the low or high word from the source generalregister, the word is selected by LOMUX 1631 and MOMUX 1629 from eitherlatches 1617 and 1619 or latches 1619 and 1621 for output to the 16least significant bits of internal data bus 1115, and HOMUX 1627 outputs0's to the remaining 8 most significant bits of internal data bus 1115.When SIZE specifies all 24 bits of general register 1103, finally, HOMUX1627 selects the contents of HLA 1617 for output to the 8 mostsignificant bits of internal data bus 1115, MOMUX 1629 selects thecontents of MLA 1619 for output to the next most significant bits, andLOMUX 1631 selects the contents of LLA 1621 for the 8 least significantbits of internal data bus 1115.

MOVE with Input Latch 1149 as the Source: FIG. 14

One of the special registers which may function as a source of data in aspecial register to general register 1103 MOVE instruction or a specialregister to special register MOVE instruction is input latch 1149. Whenmicroprocessor 107 performs a READ I/O operation, the data received frommemory 102 in the read operation is loaded into input latch 1149. Asindicated above, the time required to complete an I/O operation oftencannot be determined until it is done. A corollary of this fact is thatthe time when data resulting from a given READ operation will be presentin input latch 1149 also cannot be determined until the data is them.

The corollary in turn has important consequences for the operation ofinstruction pipeline 1901. Instruction pipelines 1901 are generallyintended to be invisible to programmers, i.e., the result of executionof instructions by the pipeline is exactly the same as if the executionof each instruction was completed before the execution of the followinginstruction was begun. As long as each instruction syllable requires thesame number of cycles to execute as all the others, there is in fact nodistinction between sequential execution of instructions and executionof instructions in a pipeline. However, that is not the case when thereare instructions such as the I/O instructions of microprocessor 107. Aprogram writing a sequence of instructions which includes a READinstruction followed by a MOVE instruction which has input latch 1149 asa source will naturally assume that when the MOVE instruction isexecuted, the data in input latch 1149 will be the data which was readfrom memory 102 by the READ instruction. The problem is that the MOVEinstruction is always executed in three phases of one cycle each, whilethe READ instruction is executed in five phases which take a minimum of5 cycles and may require an indefinite number of cycles. Consequently,even though a MOVE instruction follows a READ instruction in pipeline1901, the MOVE instruction may complete all phases of its executionbefore the data read by the READ instruction is in latch 1149.

To prevent such an occurrence, microprocessor 107 keeps track of whetherthe last I/O instruction executed by microprocessor 107 has completedits EIO phase 1913. If it has not, microprocessor 107 halts instructionpipeline 1901 when it decodes the first MOVE instruction following theI/O instruction. Pipeline 1901 remains halted until the I/O instructionhas completed EIO phase 1913. If the I/O instruction was a READinstruction, the data read from memory 102 by the instruction will atthat point be in input latch 1149 and the MOVE instruction may safelyenter the execute phase. Such halting of a pipeline to await theconclusion of execution of an instruction is termed a pipeline exceptionor stall in the art. Dealing with pipeline stalls is an importantproblem in the design of pipelined processors.

The portion of FIG. 14 labeled 1401 shows the effect of this arrangementon pipeline 1901 when a sequence of READ and MOVE from IL instructionsare being executed. As in FIG. 19, the rows represent the phases ofinstruction pipeline 1901, while the columns represent clock cycles. Thefigure presumes that EIO phase 1913 of I/O pipeline 1909 lasts no morethan two cycles for each READ instruction. In cycle n, the first systemread instruction, SysR1, enters fetch phase 1903; in cycle n+1, thefirst move from the input latch instruction, MIL1, enters fetch phase1903 and SysR1 enters decode phase 1905; in cycle n+2, the next systemread instruction, SysR2, enters fetch phase 1903, MIL1 enters decodephase 1905, and SysR1 enters execute phase 1907. Since SysR1 has notfinished its EIO phase 1913 by the end of cycle n+2, microprocessor 107stops pipeline 1901 at cycle n+3, as indicated by the label W 1405 inthe column for that cycle. I/O pipeline 1909 continues, and SysR1's EIOphase 1913 lasts through cycle n+4. That being the case, instructionpipeline 1901 remains stopped in cycle n+4 as well. At the end of thatcycle, the data is available for MIL1, which performs the move in cyclen+5. In cycle n+6, SysR2 is in execute phase 1907, MIL2 is in decodephase 1905, and the next read instruction, SysR3 is in fetch phase 1903.Since SysR2 has again not finished its EIO phase 1913, pipeline 1901again stops at cycle n+7. It remains stopped through cycle n+8, and MIL1will enter its execute phase and perform the move at cycle n+9 (notshown). As can be seen from this description, even though I/O pipeline1909 allows a system read operation to be performed every two cycles,the maximum rate at which reads combined with moves from input latch1149 can be performed is once every 4 cycles.

The foregoing shows how stalls of instruction pipeline 1901 candrastically slow execution of a sequence of instructions. In order toincrease the speed of reads followed by moves from input latch 1149,microprocessor 107 has a special form of the MOVE instruction whichpermits the programmer to move data from input latch 1149 before thelast I/O instruction preceding the MOVE has finished its EIO phase 1913.The special form is called "move instruction latch no wait" (MILNW), andis specified by means of a special code in SPR field 1227 of the type 2MOVE instruction or SPS field 1239 of the type 3 MOVE instruction. WhenMILNW is specified as the source register by means of the special code,a MOVE instruction will move new data from input latch 1142 as soon asthe new data arrives. In a preferred embodiment, new data is identifiedby keeping track of whether the data in input latch 1149 has been movedfrom the latch; if it has not been, the data is new and will be moved byMOVE with MILNW. Using MILNW, it is possible to perform a READ combinedwith a move from input latch 1149 once every two cycles. Of course, theprotection provided by the MOVE instruction without MILNW is lacking,and it is up to the programmer using MILNW to ensure that the SysRinstructions and the MILNW instructions are in the proper sequence.

Portion 1403 of FIG. 14 shows how MILNW works. As before, the first Readinstruction, SysR1, enters fetch phase 103 in cycle n. The programmerwriting the code knows that the phases of SysR1 will require at least 5cycles; consequently, he does not follow SysR1 with the MOVEinstruction, but instead with the next READ instruction, SysR2. Thus, incycle n+1, SysR1 is in decode phase 1905 while SysR2 is in fetch phase1903. The MOVE instruction, in the special form MILNW, comes in cyclen+2. In that cycle, SysR1 is in execute phase 1907 of instruction pipe1901 and load phase 1911 of I/O pipe 1909 and SysR2 is in decode phase1905. The instruction following MILNW1 in cycle n+3 is another READinstruction, SysR3. MILNW1 is in decode phase 1905, SysR2 is in executephase 1907 of instruction pipe 1901, and SysR1 is in the first cycle ofEIO phase 1913 of I/O pipe 1909. Since the data being read by SysR1 willbe back in the second cycle of EIO phase 1913, i.e., in cycle n+4 at theearliest, input latch 1149 presently has no data and MILNW1 cannot enterexecute phase 1907; consequently, microprocessor 107 stops instructionpipe 1901 for the cycle n+4. EIO phase 1913 for SysR1 is complete at theend of cycle n+4, so microprocessor 107 restarts instruction pipe 1901in cycle n+5. The data from SysR1 is now available in input latch 1149and MILNW1 moves it to the specified destination in cycle n+5. In thatcycle also, SysR2, which has been waiting in load phase 1911 of I/O pipe1909 for EIO phase 1913 for SysR1 to finish, enters EIO phase 1913.Further, SysR3 is in decode phase 1905, and the next MILNW instruction,MILNW2, is in fetch phase 1903. As may be seen from the remainder ofportion 1403, from this point forward, a read and a move from inputlatch 1149 may be performed every two cycles instead of every fourcycles, as is the case with the regular MOVE instruction.

Effectively, the MOVE instruction with MILNW as the source permits theprogrammer of microprocessor 107 to take advantage of his knowledge ofthree facts:

that the phases of an I/O instruction requires a minimum of five cycles;

that I/O pipeline 1909 operates independently of instruction pipeline1901; and

that the I/O pipeline permits a second I/O instruction to enterexecution phase

1907 of instruction pipeline 1901 before the first I/O instruction hasfinished execution.

Because the above is the case, execution of SysR1 and SysR2 can overlapin both instruction pipeline 1901 and I/O pipeline 1909 and the movefrom input latch 1149 of the data placed there by SysR1 can be performedwhile SysR2 is waiting for the data to be returned from Memory 102. MOVEwith ILNW consequently permits a series of reads from memory 102 toregisters 1103 in which each read requires only two cycles.Conceptually, MOVE wi MOVE with MILNW provides the programmer with aninstruction which behaves exactly the same way as the usual move frominput latch 1149, except that MOVE with MILNW does not have the sideeffect of halting instruction pipeline 1901 as soon as the MOVE entersdecode phase 1905.

ALU Instructions with ALUSIZE: FIGS. 15 and 16

ALU instructions specify operations performed by ALU 1107 on operandsfrom four sources:

a general register 1103;

B register 1105;

Accumulator register 1109; and

eight-bit literal values contained in the ALU instructions.

The operations include addition, subtraction, left and fight shift, andlogical operations including AND, OR, and NOT. A special feature ofthese operations is the ability to specify in the instruction that CARRYand ZERO condition bits in program status word 1119 not be affected byan ALU operation or be set according to the effect the operation has onthe least significant 8 bits of the result, the least significant 16bits, or the entire 24-bit result.

FIG. 15 shows ALU instruction 1501 for microprocessor 107. Beginningwith the most significant bits, bits 20-23 are opcode 1503 for theinstruction, ALU size bits 19-17 (AS 1505) specify whether the statusbits are to be set at all, and if they are, whether they are to be setfrom the least significant 8 bits, the least significant 16 bits, orfrom the entire result. ALU operation bits 12-16 (AOP 1507) specify theoperation to be performed by ALU 1107; SI77E field 1209 specifies whichbytes of a general register 1103 are to serve as a source for an ALUoperation; in some operations, bits 0-7 specify an 8-bit immediate value1509; if they do not, bits 0-8 specify a general register 1103 asdescribed for the MOVE instruction, with bit 8 indicating whether bits0-7 represent the address of a general register 1103 directly or anoffset from the address in frame pointer register 1117.

Implementation of ALlYSIZE in a preferred embodiment is shown in portion1107 of FIG. 16. As previously indicated, muxes 1627, 1629, and 1631provide inputs from general registers 1103 and ACCO 1110 to ALU 1643;input 1641 of ALU 1643 receives data from B register 1105 or from IMMfield 1509 of the ALU instructions. Besides outputting the result of theALU operation to ACC 1109, ALU 1643 also outputs an 8-bit carry signalC8, a 16-bit carry signal C16, and a 24-bit carry signal C24. Eachsignal is active if there is a carry out of the 8, 16, or 24 leastsignificant bits respectively as a result of the ALU operation.Additionally, zero generator (ZG) 1641 receives all 24 bits of theresult and generates a code indicating whether the least significant 8bits were all 0, whether the least significant 16 bits were all 0, orwhether all 24 bits were 0. The code and the three carry signals go toALU Size Control (ASZCTL) 1637, which further takes as an input a valuederived from ALU Size field 1505 of the ALU instruction. The output ofASZCTL 1637 are signals C 1633 and Z 1635 which set the Carry and Zerobits in program status word 1119. Depending on the code in ALU Sizefield 1505, ASZCTL 1637 may not set the Carry and Zero bits, may setthem in accordance with the state of the least significant byte, may setthem in accordance with the state of the least significant two bytes, ormay set them in accordance with the state of the entire bit result.

The combination of general registers in which individual bytes and wordsare addressable and an ALU in which zero and carry may be determined fora byte of a result, a word of a result, and the entire 24-bit resultmakes microprocessor 107 into a powerful and flexible data processingmachine. For example, 16 or 24-bit bit sequences may easily be read frommemory 102 and then processed inside microprocessor 107 as sequences oftwo or 3 bytes. It is also easy to deal with a sequence of bits as botha single data item and as a structured data item.

System Memory I/O in Microprocessor 107: FIGS. 2 and 9

Another area in which microprocessor 107 is particularly adapted forefficient and flexible use in a variety of systems is system memory I/O.In system memory I/O, data is read from and written to memory 102 viasystem bus 103. In preferred embodiment 201 of microprocessor 107,microprocessor 107 is connected to system bus 103 by 16 data lines and23 address lines. Each address specifies a 16-bit word in memory 102.The system I/O operations performed by microprocessor 107 include readsand writes for bytes, 16-bit words, and 24-bit pointers andread-modify-writes for bytes and words. In the byte reads, the signalsERE and ORE (see FIG. 2) specify whether the even or odd byte of theword specified by the address is being read. In the byte writes, thecorresponding signals are EWE and OWE.

FIG. 9 shows the timing of a system memory byte read: Oncemicroprocessor 107 has gained access to bus 103, the byte read requiresa minimum of two cycles of clock 501 on bus 103: one to place theaddress, the address strobe signal AS and either ERE or ORE on the busand one to receive the data from bus 103. The timing is substantiallythe same as shown above for the byte write and the word read and write.The 24-bit pointer read and write operations require 4 cycles: two asdescribed above for two bytes of the pointer and two more for the thirdbyte. The read-modify-write instructions require a minimum of fourcycles: two for the read and two for the write. More time may berequired for any of the I/O operations if memory 102 is unable torespond immediately. For this reason, memory 102 provides the DTACKsignal to microprocessor 107 when it has provided the data in a readoperation or received the data in a write operation. Microprocessor 107waits for the DTACK signal before it concludes the second cycle of aread or write operation.

I/O Subsection 1135: FIG. 11

The instruction architecture for microprocessor 107's system I/Oinstructions is shown in I/O subsection 1135 of FIG. 11. Registers inSection 1135 are accessible by means of internal data bus 1115.Programmer-specifiable registers include ALR 1145, which is loaded witha 24-bit address on a read operation, ALW 1146, which is loaded with anaddress on a write operation, input latch 1149, which receives data fromsystem bus 103 on a read operation, and output latch 1151, whichreceives data to be written to system bus 103 on a write operation. Bothinput latch 1149 and output latch 1151 are 24-bit registers; byte I/Ooperations read or write the 8 least significant bits, word operationsthe 16 least significant bits, and pointer operations the entireregister.

Section 1135 further includes registers which are part of I/O pipeline1909. Shadow address latch (SAL) 1141 holds the address for an I/Oinstruction which has entered load phase 1911 before the preceding I/Oinstruction has left EIO phase 1913. Shadow output latch (SOL) 1155holds the data to be output by a write instruction which is in EIO phase1913 when a following I/O instruction enters load phase 1911, thusmaking OL 1151 available to be loaded before the write operation iscomplete. Operation of I/O pipeline 1909 is as follows: if the pipelineis empty when an I/O instruction enters load phase 1911, ALR 1145 isloaded if the I/O instruction is a read instruction. If it is a writeinstruction, OL 1151 has been loaded by a previous MOVE instruction andload phase 1911 loads ALW 1146. On the first cycle of EIO phase 1913 forthe write instruction, the contents of OL 1151 are moved to SOL 1155,freeing OL 1151 to be loaded by a MOVE instruction in that same cycle orlater. On the first cycle of EIO phase 1913 after microprocessor 107 hasgained access to bus 103, the data in SOL 1155 and the address in ALW1146 are output to bus 103 until memory 102 responds with the DTACKsignal. If there is already an I/O instruction in pipeline 1909 when thenext I./O instruction enters load phase 1911, the address is loaded intoSAL 1141. Finally, if SAL 1141 is full when an I/O instruction whoseexecute phase 1907 would load that register reaches decode phase 1905,instruction pipeline 1901 is halted until the register becomesavailable.

In preferred embodiment 201, address and data processing typical of I/Ooperations is performed in I/O subsection 1135, so that ALU 1107 mayconcurrently perform other operations. One example of such processing isoffset adder 1139. When an address is loaded into ALR 1145 or ALW 1146,an offset 1137 which is specified in the I/O instruction may be added tothe address; moreover, the instruction may specify either ALR 1145 orALW 1146 as the source of the address for an I/O operation and useoffset adder 1139 to add the offset to the current contents of thespecified register. As may be seen from FIG. 11, this is implemented bymeans of buses connecting the outputs of ALR 1145 and ALW 1146 tointernal data bus 1115, which in turn provides the address input tooffset adder 1139.

Another example of such processing is the provision of both ALR 1145 andALW 1146 and the provision of a connection between the output of inputlatch 1149 and the input of shadow output latch 1155. These featurestaken together permit efficient movement of data from one location inmemory 102 to another location in memory 102. Since both the read andwrite addresses are available in ALR 1145 and ALW 1146 and input latch1149 is available as a source of data for the write operation, the writeoperation may immediately follow the read operation and the transfer ofa word or byte from one location to another in memory 102 requires aminimum of four cycles. Finally, AND/OR select logic is provided betweenIL 1149 and OL 1151 on the one hand and SOL 1155 on the other. Thispermits the contents of OL 1151 (loaded by a previous MOVE instruction)to be ANDed or ORed with the contents of IL 1149, and thus permitsreading of data from memory 102, modifying it by means of a mask in OL1151, and writing the data back to memory 102 in a minimum of fourcycles.

I/O Instructions: FIGS. 13, 17, and 18

Microprocessor 107 has three I/O instructions: a READ instruction, aWRITE instruction, and a READ-MODIFY-WRITE instruction. The formats ofall three instructions are shown in FIG. 13. The READ instruction isidentified by reference number 1301, the WRITE instruction by referencenumber 1313, and the READ-MODIFY-WRITE instruction by reference number1319. As is apparent in that FIG., all of the I/O instructions have anumber of features in common. Beginning with the most significant bits,bits 20-23 are the opcode, which is different for each of the threeinstructions; bits 12-19 are an 8-bit OFFSET value which is added to thevalue of a pointer to obtain the address used in the I/O operation. I/OSize (IOS) field 1307 (bits 11 and 10) indicates the size of the data tobe read or written and, in conjunction with I/M pin 209, the format of16-bit words and 24-bit pointers. Bits 0 through 8 make up pointer (PTR)field 1311, which specifies a register of microprocessor 107 whichcontains a value to be used as a pointer, i.e., a value representing alocation in memory 102, in the I/O operation. The specified register mayeither be a general register 1103 or one of the special registers, mostgenerally ALR 1145 or ALW 1146. In the case of a general register 1103,the register is either specified directly by means of its number in GRfield 1229 or indirectly by means of an offset from the value in framepointer 1117. As with the MOVE instructions, F bit 1211 indicates whichmode is being used. In the case of a special register, SR field 1312contains a code for the special register, while bits 4-8 are a don'tcare field, here DC 1310.

As is clear from the common fields described above, microprocessor 107executes I/O instructions generally as follows: in decode phase 1905,the pointer indicated by pointer fields 1311 is made the source forinternal data bus 1115; in execute phase 1907, the pointer value passesvia internal data bus 1115 to either of ALR 1145 or ALW 1146, dependingon the kind of I/O instruction. As the pointer is being moved, theoffset in bits 12-19 is added to it by offset adder 1139. Execute phase1907 is thus simultaneously load phase 1911 for instruction pipeline1909. EIO phase 1913 of instruction pipeline 1901 begins in the cyclefollowing the loading of the pointer into ALR 1145 or ALW 1146. Ifinstruction pipeline 1901 already has an I/O instruction in it, thepointer is loaded into SAL 1141 instead of ALR 1145 or ALW 1146.

WRITE instruction 1313 additionally has latch source (LS) field 1317.One setting of the single-bit field indicates that the source of thedata to be written is output latch 1151; the other setting indicatesthat it is input latch 1149. The utility of this arrangement forperforming back-to-back memory reads and writes has already beendescribed.

READ-MODIFY-WRITE instruction 1319 also has an additional one-bit field:AND/OR field 1323. One setting of the bit indicates that logic 1153 isto AND the contents of IL 1149 with those of OL 1151; the otherindicates that logic 1153 is to OR the contents of the two registers.Again, the utility of this arrangement for performing read-modify-writesin four cycles has already been described. As previously indicated,READ-MODIFY-WRITE only writes bytes or words; consequently, IOS field1307 in this instruction cannot specify a 24-bit data item.

Reads and Writes with Different Data Formats: FIGS. 11 and 17

As shown in FIG. 1, in many applications, microprocessor 107 will becooperating with a host processor 105. In some applications, hostprocessor 105 may be another microprocessor 107; however, in others, itwill be a different processor or microprocessor. In particular, it ishighly probable that host processor 105 will have either the Intel 80×86architecture or the Motorola 680×0 architecture. Two of the ways inwhich these architectures differ are the format of their pointers andthe manner in which bytes are stored in 16-bit words. Three features ofmicroprocessor 107, I/M pin 209, a code in IOS field 1307 of the I/Oinstructions, and the SWB bit in program status word 1119, permitmicroprocessor 107 to be easily employed with either an 80×86 host or a680×0 host. The code in IOS field 1307 further permits a programer towrite a single program which will execute properly in both the 80×86 and680×0 environments.

FIG. 17 shows the different ways the 80×86 architecture and the 680×0architecture organize bytes in memory 102 and the different ways inwhich they format pointers. In the byte and word examples, the figurepresumes that a sequence of 4 bytes with the values AA, BB, CC, and DDare being stored. When an 80×86 performs a sequence of byte writeoperations to a memory organized into 16-bit words and the sequencebegins on a word boundary, the results are shown at 1701: the first byteAA is written to the 8 least significant bits of the first word, thenext, BB, to the 8 most significant bits of the first word, the next,CC, to the 8 least significant bits of the second word, and the next,DD, to the 8 most significant bits of the second word. When a 680×0performs the same operation, the results are shown at 1703: the firstbyte AA is written to the 8 most significant bits of the first word, thenext byte BB is written to the 8 least significant bytes of that word,the third byte CC is written to the 8 most significant bytes of thesecond word, and the fourth byte DD is written to the 8 leastsignificant bytes of the second word.

On the other hand, when the same four bytes are written by word writeoperations, with the first word write writing bytes AA and BB and thesecond word write writing the bytes CC and DD, there is no differencebetween the 80×86 and 680×0 organizations, as shown by 1705. In bothcases, AA is in the 8 most significant bits of the first word to bewritten, BB is in the 8 least significant bits, CC is in the 8 mostsignificant bits of the second word, and DD is in the 8 leastsignificant bits of that word.

Continuing with the pointer formats, both architectures employ 32-bitpointers which are stored in two adjacent words. Processor 107 uses24-bit addresses and is consequently only concerned with the 24 leastsignificant bits of the 32-bit pointers. Presuming that the 24 leastsignificant bits have the value AABBCC, with AA being the mostsignificant byte and CC the least, the 80×86 format is that shown at1707 and the 680×0 format is that shown at 1709. In the 80×86 format,the most significant byte of the pointer is in the 8 least significantbits of the second word, the next most significant byte is in the 8 mostsignificant bits of the first word, and the least significant byte is inthe least significant bits of the first word. In the 680×0 format, themost significant byte of the pointer is in the least significant 8 bitsof the first word, the next most significant byte is in the mostsignificant 8 bits of the second word, and the least significant 8 bitsare in the least significant 8 bits of the second word.

Microprocessor 107 deals with some of the inconsistencies between the80×86 and 680×0 architectures by means of I/M pin 209. Whenmicroprocessor 107 is operating with an 80×86 host 105, Vcc is input topin 207; when microprocessor 107 is operating with a Motorola 680×0 host105, pin 207 is grounded. Generally, pin 207 will be either tied toground or Vcc, since the type of host processor 105 is not likely tochange with any frequency. The input to the pin 207 could, however, bemade switchable in order to permit system reconfiguration.

Beginning with the byte operations, these are specified in IOS field1307 of the instruction by means of the code "00". In the byte writeoperation, the byte to be written is contained in the least significant8 bits of SOL 1155; in both 80×86 and 680×0 modes, the byte is output toboth bits 0-7 and 8-15 of data lines 313 of bus 103. The input at theI/M pin and the value of the least significant bit of the address thendetermine whether the EWE signal or the OWE signal is enabled to writethe byte to the upper or lower byte of the addressed word, as requiredby the 80×86 and 80×0 memory formats.

In the byte read operations, the odd byte will be on lines data 8-15 andthe even byte on data lines 0-7; in the second case, the reverse will betrue. Which byte is read into bits 7-0 of input latch 1149 in responseto a given odd or even byte address depends on the input whichmicroprocessor 107 receives on I/M pin 209 and the SWB bit in PSW 1119.If SWB is set to 0 and the input to I/M is low, indicating a 680×0 host,a read of an even byte results in the byte on lines 8-15 being read intoinput latch 1149 [7-0], while a read of an odd byte results in the byteon lines 0-7 being read into that portion of input latch 1149. If SWB isset to 0 and the input to I/M is high, indicating an 80×86 host, thereverse of the above occurs. If SWB is set to 1, finally, microprocessor107's response to the input to I/M pin 209 is the reverse of that justdescribed. SWB thus gives the programer a way of overriding the effectof I/M on byte reads.

In the read-modify-write for byte data, the read works as just describedand the write as just described for the byte write, except that the damin SOL 1155 is the contents of input latch 1149 as ANDed or ORed withthe mask in OL 1151.

Word operations are specified in I/O size field 1307 by the code 01.There is no difference between the 80×86 and 680×0 formats for 16-bitmemory words, and consequently, I/M pin 209 does not affect the mannerin which these operations are performed. In the write, the lower 16 bitsof SOL 1155 are output to data lines 313; in the read, the bits on datalines 313 are latched into the lower 16 bits of input latch 1149. Thesame is the case for the read portion of the read-modify-write and thewrite portion of that operation.

A pointer read operation, indicated by the code 10 in I/O size field1307, requires that two words be fetched from memory 102. If the host isa 680×0, the lower byte of the first word contains the most significantbyte of the pointer, while the upper and lower bytes of the next wordcontain the next less significant byte and the least significant byte.Thus, when I/M pin 209 indicates that the host is a 680×0, the read ofthe first word from memory 102 causes the contents of data lines 313[70] to be placed into input latch 1149 [23-16]. When the second word isread from memory 102, the contents of data lines 313 [15-8] go intoinput latch 1149 [15-8] and the contents of data lines 313 [7-0] gosimultaneously into latch 1149 [7-0].

If the host is an 80×86, the first word contains the least significantbyte of the pointer in its lower byte and the next least significantbyte of the pointer in its upper byte; the second word contains the mostsignificant byte of the pointer in its lower byte. Consequently, whenI/M pin 209 indicates that the host is an 80×86, the read of the firstword from memory 102 results in the contents of data lines 313 [158]being placed into input latch 1149 [15-8] and those of data lines 313[7-0] being placed into input latch 1149 [7-0]. On the next cycle, thecontents of data lines 313 [7-0] are placed in input latch 1149 [23-16].

When pointers are being written, if I/M pin 209 indicates that the hostis a 680×0, the write of the first word to memory 102 results in shadowoutput latch 1155 [23-16] being placed on D 313 [7-0] and zeros beingplaced on z 313 [15-8], while the write of the second word results inshadow output latch 1155 [15-8] being placed on D 313 [15-8 ] and shadowoutput latch 1155 [7-0] being simultaneously placed on D 313 [7-0]. IfI/M pin 209 indicates that the host is an 80×86, the write of the firstword results in shadow output latch 1155 [15-8] being placed on D 313[158] and shadow output latch 1155 [7-0] being simultaneously placed onD 313 [7-0]. The write of the second word results in shadow output latch1155 [23-16] being placed on D 313 [7-0] and zeros being placed on D 313[15-8].

The I/M pin 209 by itself ensures that if host processor 105 does abyte, word, or pointer write of data to memory 102 and microprocessor107 does a byte, word, or pointer read of the same data from memory 102or vice-versa, both host processor 105 and microprocessor 107 willreceive the data in the expected format. However, if host processor 105does two byte writes to memory 102 and microprocessor 107 does a wordread of the two bytes, the positions of the bytes in the word willdepend on whether host processor 105 is an 80×86 or a 680×0, and thecode in microprocessor 107 which processes the word will depend on thetype of host processor. Since this is the case, a change in hostprocessor would require extensive revision of the code, which in turnwould greatly increase the cost of developing systems usingmicroprocessor 107.

This problem is solved in microprocessor 107 by the code 11 in I/O size1307. That code indicates "word with swapped byte" i.e., that word I/Ooperations are to be employed but that the bytes of the word are to beswapped if I/M pin 209 indicates that the host is an 80×86 machine.Thus, if "word with swapped byte" is indicated in an I/O instruction,microprocessor 107 will be able to correctly perform word read and writeoperations on byte data regardless of whether the host is a 680×0machine or an 80×86 machine, and there will be no need to writedifferent code depending on the type of host machine.

The "word with swapped byte" code and I/M pin 209 interact to producethe result described above as follows: In a read operation, when I/Mspecifies a 680×0 host, the contents of D 313 [15-8] go to input latch1149 [15-8] and those of D 313 [7-0] go to input latch 1149 [7-0]; whenI/M pin 209 specifies an 80×86 host, the contents old 313 [15-8] go toinput latch 1149 [7-0] and those old 313 [7-0] go to input latch 1149[15-8]. In a write operation, when I/M pin 209 specifies a 680×0 host,the contents of shadow output latch 1155 [7-0] go to D 313 [7-0] andthose of shadow output latch 1155 [15-8]go to D313 [15-8]. When I/M pin209 specifies an 80×86 host, the contents of shadow output latch 1155[7-0] go to D 313 [15-8] and those of shadow output latch 1155 [8-15] goto D 313 [7-0]. In the read-modify-write with "word with swapped byte"the read and the write phases of the operation are as just described forthe read operation and the write operation.

Implementation of Data Input and Output: FIGS. 18, 20, 21-23

FIGS. 18, 20, 21-23 show the implementation in preferred embodiment 201of input latch 1149, output latch 1151, shadow output latch 1153, AND/OR1323, and the control logic which controls those devices. Beginning withFIG. 20, that figure shows input latch 1149 and the multiplexers whichpermit the byte swapping operations just described. Input latch 1149 ismade up of three 8-bit latches, latch 2007, containing the mostsignificant byte, latch 2009, containing the next most significant byte,and latch 2011, containing the least significant byte. Output from thelatches is to input latch output (ILO) 2013. Input to the latches comesfrom muxes 2001, 2003, and 2005. Each of these muxes takes input fromdata lines 313 and ILO 2013. Specifically, mux 2001 selects input forlatch 2007 from data lines 313 [7-0] or input latch 1149 [23-16], mux2003 selects input for latch 2009 from data lines 313 [15-8], data lines313 [7-0], or input latch 1149 [15-8], and mux 2005 selects input forlatch 2009 from data lines 313 [15-8], data lines 313 [7-0], or inputlatch 1149 [ 7-0]. If a mux 2001, 2003, or 2005 is not selected, itoutputs 0's. Selection is performed by selection lines A, C, D, F, G, J,L, and M according to the table below. The notation source→destinationin the table indicates that the data in the source is transferred to thedestination when the selection line is active.

    ______________________________________                                        Sel. line      Effect                                                         ______________________________________                                        A              IL 1149 [23-16] → IL [23-16]                            C              D 313 [7-0] → IL [23-16]                                D              IL [15-8] → IL [15-8]                                   F              D [15-8] → IL [15-8]                                    G              D [7-0] → IL [15-8]                                     J              IL [7-0] → IL [7-0]                                     L              D [7-0] → IL [7-0]                                      M              D [15-8] → IL [7-0]                                     ______________________________________                                    

Continuing with FIG. 21, that figure shows the implementation of outputlatch 1151, AND/OR logic 1153, and shadow output latch 1155. Inputs forthis circuitry come from internal data bus 1115, input latch 1149 viaILO 2013, and shadow output latch 1155. Output is to data lines 313.Selection of inputs is by multiplexer 2101, while selection of outputsis by multiplexers 2109 and 2111. If one of these multiplexers is notselected, it outputs 0's. Beginning with output latch 1151, that latchreceives its inputs from internal data bus 1115 and provides outputs toAND/OR logic 1153 and to multiplexer 2101. Multiplexer 2101 additionallyreceives inputs from ILO 2013, which is connected to the output of inputlatch 1149, SOL 1155, and AND/OR logic 1153. Output from mux 2101 is toshadow output latch 1155, which has three 8-bit latches, latch 2103,containing bits [23-16], latch 2105, containing bits [15-8], and latch2107, containing bits [7-0]. Outputs are via muxes 2109 and 2111 to D313 [7-0] and [15-8]. Selection of inputs is by selection lines U,V,W,and X for mux 2101 and P,Q,R,S, and T for muxes 2109 and 2111. The tableshows the line and the result of the selection.

    ______________________________________                                        Sel. line     Effect                                                          ______________________________________                                        U             SOL 1155 → SOL 1155                                      V             IL 1149 or ILO 2013 → SOL                                W             OL 1151 → SOL                                            X             IL → A/O Logic 1153 → SOL                         P             SOL [23-16] → D 313 [7-0]                                Q             SOL [15-8] → D [7-0]                                     R             SOL [7-0] → D [7-0]                                      S             SOL [15-8] → D [15-8]                                    T             SOL [7-0] → D [15-8]                                     ______________________________________                                    

The selection lines are controlled by selection logic 1801, shown inFIGS. 18, 22, and 23. The selection lines are the outputs of I/O controllogic (I/OCTL) 1819; the inputs for the logic are the following:

    ______________________________________                                        Signal   Meaning                                                              ______________________________________                                        RW       1: Read operation;                                                            0: write operation                                                   RMW      1: Read/modify/write operation                                       RMWW     0: Read part of read-modify-write operation;                                  1: write part                                                        IOS      Codes from IOS 1307                                                  IL/OL    0: write data from OL 1151;                                                   1: write data from IL 1149                                           LONG2    Second part of pointer read or write                                 AO       Least significant address bit;                                                0: even byte;                                                                 1: odd byte                                                          ITL      1: 80 × 86 mode unless SWB is set;                                      0: 680 × 0 mode unless SWB is set (see below)                  ______________________________________                                    

The RW, RMW, IOS, and IL/OL signals are all derived ultimately from theI/O instructions; A0 is derived from the contents of ALR 1145 or ALW1146, depending on the I/O operation; LONG2 and RMWW are derived frominternal control logic of microprocessor 107 which keeps track of thephase of execution of I/O instructions; ITL is produced by ITL logic1803. When ITL has the value 1, I/O section 1135 operates as ifmicroprocessor 107 was operating in a system with an 80×86 host; whenITL 1817 has the value 0, I/O section 1135 operates as if microprocessor107 was operating with a 680×0 host. With operations other than byte I/Ooperations, the value of ITL 1817 is determined solely by the valuemicroprocessor 107 is receiving on I/M pin 209; with the byteoperations, the effect of the I/M pin 209 may be reversed by setting theSWB bit in program status word 1119 to 1.

This effect is produced by ITL logic 1803 as follows: ITL 1817 is thenegated output of XOR gate 1815; the inputs to gate 1815 come from I/Mpin 209 and NAND gate 1811, which has three inputs. Inputs IOS0 1805 andIOS1 1807 are the negations of IOS 1307; PSW₋₋ SWB 1809 is derived fromthe PSW status bit. When either IOS0 1805 or IOS1 1807 is low,indicating that IOS 1307 specifies something other than byte I/O, NANDgate 1811 has a 1 output at 1813 and negated output 1817 of XOR gate1815 is the same as the input from I/M pin 209. When both inputs 1807and 1805 are high, indicating the 00 code for byte I/O, the output ofgate 1811 is determined by PSW₋₋ SWB 1809. When input 1809 is low, NANDgate 1811 still has a 1 output, and output 1817 is the same as input209, as just described. When input 1809 is high, i.e., when the SWB bitis set in PSW 1809, NAND gate 1811 has an 0 output and output 1817 isthe inverse of input 209, that is, the effect of I/M pin 209 isreversed.

Operation of I/OCTL 1819 is shown in the truth tables of FIGS. 22 and23. FIG. 22 shows the truth table for READ and READ-MODIFY-WRITEoperations. There are sections of the table for byte reads, word reads,word reads with the WSB code in IOS 1307, pointer reads, byteread-modify-writes, word read-modify-writes, and word read-modify-writeswith the WSB code in IOS 1307. The columns in the center pan of thetable indicate values for the input signals to I/OCTL 1819; the columnsin the fight-hand part of the table indicate values resulting from theinputs on selector lines 1833. In the center portion of the table, "X's"indicate "don't care" bits, i.e., bits whose value makes no differencein the operation indicated by the row. In the fight-hand portion of thetable, "." indicates a "don't care" bit. Taking the first row of thetable as an example, the row shows that when RW=1, indicating a readoperation, RMW=0, indicating that it's not a read-modify-write, IOSindicates a byte operation (i.e., has the code 00), ITL has the value 0,indicating 680×0 mode, and A0 has the value 0, indicating an even byteaddress, then select line M is high and the rest low. The values on theinput lines indicate that the operation specified by the row is a readof an even byte from data that is stored in 680×0 format. Turning toFIG. 20, it may be seen that when select line M is active, mux 2005selects D 313 [15-8] as the source for input latch 1149 [7-0]. Turningthen to FIG. 17, it may be seen that the selected byte is indeed an evenbyte in 680×0 byte format 1703. When read as just indicated, the truthtables of FIGS. 22 and 23 and the logic diagrams of FIGS. 18, 20, and 21show how the read and write operations just described are implemented inpreferred embodiment 201.

Conclusion

The foregoing "Detailed Description" has shown how to make and use aprocessor which shares memory with other processors and in which thesame code can be used even though the memory is shared with otherprocessors having different data formats. In the embodiment disclosed inthe "Detailed Description", the data formats concerned the ordering ofbytes; however, the invention may be employed with data formats whichdiffer in other ways. In the disclosed embodiment, the instructionswhose operation is dependent on the data formats are I/O instructions;again, the principles of the invention may be employed with other typesof instructions. Instructions which fall within the ambit of theinvention may be specified by means other than the WSB code in theIOSIZE field employed in the disclosed embodiment, and the actualswapping may be achieved by circuitry other than the circuitry disclosedin the present application. For these reasons, the implementationdisclosed in the "Detailed Description" is to be regarded in allrespects as merely illustrative and exemplary and the invention claimedherein is not defined by the disclosed implementation, but instead bythe claims as interpreted in light of the doctrine of equivalents.

What is claimed is:
 1. In a processor able to share memory containingdata with another processor and having instruction execution means forexecuting instructions, the improvement comprising:data format signalreceiving means for receiving a data format signal from a sourceexternal to the processor which provides the data format signalindependently of the instructions currently being executed and the datacurrently being processed by the processor, the data format signalindicating a data format which is an order of pluralities of bytes inthe memory employed by the other processor; and operation means in theinstruction execution means, the operation means being responsive todata format dependency indicating means in certain ones of theinstructions which indicate that the manner in which a read or writeoperation specified by the instruction is executed depends on the dataformat employed by the other processor and being also responsive to thedata format signal to perform the operation specified by the instructionas required by the data format indicated by the data format signal. 2.The processor set forth in claim 1 wherein:the number of bytes in thepluralities of bytes is two; a first one of the other processors is ableto place the two bytes in a first order in the memory; a second one ofthe other processors is able to place the two bytes in a second order inthe memory; the data format signal indicates either the first order orthe second order; and the read operation places any two bytes being readfrom the memory in the first order when the data format signal indicatesthe second order and the write operation places any two bytes beingwritten to the memory in the second order when the data format signalindicates the second order.
 3. The processor set forth in claim 2wherein:the first order is that employed by processors of the 680×0type; and the second order is that employed by processors of the 80×86type.
 4. A data processing system comprising:a memory for storing dam; afirst processor which is coupled to the memory and processes the data,the first processor belonging to one of a plurality of processor types,each processor type employing a different data format which defines anorder of pluralities of bytes in the memory for certain items of thedata; and a second processor which is coupled to the memory andprocesses the data, the second processor executing instructions whichspecify operations and which include at least one instruction whichspecifies a read or a write operation and has data format dependencyindicating means which indicate that the manner in which the processorperforms the operation specified by the instruction is dependent on thedata format employed by the first processor for the certain items andthe second processor including data format signal receiving means forreceiving a data format signal from a source external to the secondprocessor which provides the data format signal independently of theinstructions currently being executed and the data currently beingprocessed by the second processor, the data format signal indicating thedata format employed by the first processor, and operation meansresponsive to the data format signal and the data format dependencyindicating means for performing the operation specified by theinstruction as required by the data format indicated by the data formatsignal.
 5. The system set forth in claim 4 wherein:the number of bytesin the pluralities of bytes is two; a first one of the types ofprocessors is able to place he two bytes in a first order in the memory;a second one of the types of processors is able to place the two bytesin a second order in the memory; the data format signal indicates eitherthe first order or the second order; and the read operation places anytwo bytes read from the memory in the first order when the data formatsignal indicates the second order and the write operation places any twobytes written to the memory in the second order when the data formatsignal indicates the second order.
 6. The system set forth in claim 5wherein:the first one of the types is the 680×0 type; and the second oneof the types is the 80×86 type.